cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl 7.9.8: Bottleneck on multhithread HTTP fetches?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 15 Oct 2003 13:37:53 +0200 (CEST)

On Wed, 15 Oct 2003, Andrew Fuller wrote:

> I tried your "somewhat ugly" workaround for windows - ie I took out the
> socketerror() test if connect() returns zero and it runs perfectly. Very
> quick, and no CPU maxout, even with 400 simultaneous hits.

That's indeed good news.

> Do you think this is a reasonable workaround? The MSDN link you sent seems
> quite clear-cut : a 0 returned from connect() indicates the connection was
> made.

Yes I believe this is a good fix.

> FYI here's the libcurl code I modified for this test (starts line 685 in
> connect.c, libcurl 7.10.7) :-

[snip]

> Any problems with this? I'll have a look around online to see if I can pick
> up any other info.

I'll make a slightly different change, but it will still be the same effect:
no getsockopt() call on windows if connect() returns 0. My change is different
mainly because I noticed how socketerror() was called and used identically
from 3 different places in the code, so I made it a verifyconnect() function
instead to reduce code duplication.

> To answer your other questions, the minimum seems to be about 50. It's hard
> to pin down an exact number, because the behaviour isn't always consistent -
> sometimes it was fine with 50 threads. Suggests a race condition in
> winsock2 IMHO.

Yes, this is quite clearly a winsock bug.

Thanks for testing and reporting!

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
Received on 2003-10-15