Re: potential bug in multi_runsingle() in multi.c ?
Date: Wed, 18 Jun 2008 14:39:10 +0800
2008/6/18 Daniel Stenberg <daniel_at_haxx.se>:
> On Tue, 17 Jun 2008, ??? wrote:
> recently, i'm testing curl-7.18.2 + libevent-1.4.4, using multi interface
>> of curl and epoll of libevent
> Pipelining enabled I presume? Can you provide a full source code to an app
> that repeats your problems? It would make it so much easier...
my app code is similar with hiperfifo.c of curl's example, but i do lots of
(1) set CURLMOPT_PIPELINING to 1, CURLMOPT_MAXCONNECTS to 30000, using 6000
easy handles when app starts.
(2) change to ulimit -n to 60001
(3) do a pre dns to 10w hostnames, and save to file. and load it when my app
(4) add a callback function, libcurl call this callback function to get
hostname's ip before doing dns
(5) building curl with conifg --disable-ares
(6) my app's input is 10w urls, where the host's ip are already known (do a
note: (3,4,5) is just to hide dns problem, because c-ares is doing a DOS
attack to nameserver when the easy handles is large.
> 1. easyhandle A reach CURLM_STATE_PERFORM state, and do
>> 2. easyhandle B do Curl_connect(), and in the ConnectionExists() function,
>> it call Curl_disconnect(), and free the pipe which easyhandle A is using.
> Why does it call disconnect? It's only supposed to do that if it deems the
> connection "dead". Are you saying it thinks that wrongly?
i explain it below
3. easyhandle A reach CURLM_STATE_DONE state, do
> Curl_removeHandleFromPipeline again (A access the pipe, which is free by
> disconnect()), so it become some times segment fault, some times dead loop
Right, the disconnect seems to be done inproperly. I think perhaps the
> check->inuse boolean should be checked before SocketIsDead() is called on
> it, since if it actually is in use the SocketIsDead() function will cause a
> false positive... Can you figure out any details on why it disconnects and
> what we can fix to make it not do it for this case of yours?
-- you said that check check->inuse before SocketIsDead() is called ??? can one conn used by 2 easyhandle at the same time ??? then conn->data will point to which one ??? i think ConnectionExists() should not return a conn that conn->inuse == TRUE, is it right ??? > > > / daniel.haxx.se > i found the bug may be: 1. easyhandle A reach CURLM_STATE_PERFORM state, and do Curl_removeHandleFromPipeline to pipe P 2. easyhandle B reach CURLM_STATE_CONNECT state, and in the ConnectionExists() function, it calls SocketIsDead() and return TRUE, it call Curl_disconnect(), and free the pipe which easyhandle A is using. note: in stderr, i found that: after SocketIsDead() return TRUE, check->data == easyhandle A check->inuse == TRUE 3. easyhandle A reach CURLM_STATE_DONE state, do Curl_removeHandleFromPipeline again (A access the pipe, which is free by disconnect()), so it become some times segment fault, some times dead loop -- dengminwen_at_gmail.comReceived on 2008-06-18