This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 1.5.9-1: socket() appears NOT to be thread-safe


On Thu, Apr 15, 2004 at 11:16:03AM +0800, Enzo Michelangeli wrote:
>What I can do for the time being is to provide the testcase that Corinna
>asked for (attached below). Here are the results:

I can duplicate the behavior noted here.

I sent Corinna a patch in private email.  I'm not thrilled with it but
it does seem to alleviate the problem.

The problem seems to be that winsock's socket is not multi-thread safe.
That is very hard for me to believe but the strace output seems to
confirm it.

My "fix" was to just move an existing mutex lock earlier in the socket
call.  It makes me wonder, if this is really needed for socket, might it
also needed for other network calls like connect, listen, etc.?

Btw, Brian, I could duplicate this behavior with strace.  My usual trick
for doing this is to use a large buffer size:

  strace -oc:/tmp/strace.out -b1000000 threadsocket.exe n

This makes strace a little faster.  This method showed the failure for
me pretty reliably.
--
Christopher Faylor			spammer? ->	aaaspam@sourceware.org
Cygwin Co-Project Leader				aaaspam@duffek.com
TimeSys, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]