cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl + libevent2: Stalling if no data is received/written [timeout bug patch]

From: Dirk Manske <dm_at_nonitor.de>
Date: Tue, 24 Aug 2010 19:47:09 +0200

On Tuesday 24 August 2010 18:25:51 Daniel Stenberg wrote:
> On Mon, 23 Aug 2010, Dirk Manske wrote:
>
> > Duh! Looks like there's still a time-out bug with the multi interface. I've
> > played again with the examples multi-single.c and hiperfifo.c, after adding
> > CURLOPT_TIMEOUT both example programs detects time-out while connecting. But
> > after connection only multi-single.c (using curl_multi_timeout) will detect
> > a time-out, but not hiperfifo.c (using timer callback).
>
> Right, but isn't this the results of the same problem Constantine Sapuntzakis
> and I've been talking about: the fact that Curl_expire(..., 0) currently
> erases all currently set timeouts?

No. In my environment expire 0 does not remove all timeouts.
Even that coundn't be the problem, that a connected handle will not be
terminated by operation timeout.

Following test is done with patched curl, also made expire verbose, added
5s connect timeout and 10s operation timeout to hiper settings and added
time stamp to output. Then hiperfifo started and filled with:
U=http://127.0.0.1/cgi-bin/sleep ; echo $U >hiper.fifo ; sleep 5 ; echo $U >hiper.fifo

1282671213.468605 Adding easy 0x17ff468 to multi 0x17d2c98 (http://127.0.0.1/cgi-bin/sleep)
* expire [0x17ff468] 1ms
1282671213.468703 multi_timer_cb: Setting timeout to 1 ms
* About to connect() to 127.0.0.1 port 80 (#0)
* expire [0x17ff468] 5000ms
* Trying 127.0.0.1... * connected
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
* 0x17ff468 is at send pipe head!
* expire [0x17ff468] 1ms
* STATE: CONNECT => DO handle 0x181a368; (connection #0)
> GET /cgi-bin/sleep HTTP/1.1
Host: 127.0.0.1
Accept: */*

* STATE: DO => DO_DONE handle 0x181a368; (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x181a368; (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x181a368; (connection #0)
* expire [0x17ff468] 10000ms
1282671213.476529 socket callback: s=7 e=0x17ff468 what=IN Adding data: IN
* expire [0x17ff468] 10000ms
1282671213.476580 multi_timer_cb: Setting timeout to 10000 ms
1282671213.476596 1282671213.476602 timer_cb -1 1 / rc:0 run:1
1282671218.464891 Adding easy 0x181b808 to multi 0x17d2c98 (http://127.0.0.1/cgi-bin/sleep)
* expire [0x181b808] 1ms
1282671218.464952 multi_timer_cb: Setting timeout to 1 ms
* About to connect() to 127.0.0.1 port 80 (#1)
* expire [0x181b808] 5000ms
* Trying 127.0.0.1... * connected
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#1)
* 0x181b808 is at send pipe head!
* expire [0x181b808] 1ms
* STATE: CONNECT => DO handle 0x1836738; (connection #1)
> GET /cgi-bin/sleep HTTP/1.1
Host: 127.0.0.1
Accept: */*

* STATE: DO => DO_DONE handle 0x1836738; (connection #1)
* STATE: DO_DONE => WAITPERFORM handle 0x1836738; (connection #1)
* STATE: WAITPERFORM => PERFORM handle 0x1836738; (connection #1)
* expire [0x181b808] 10000ms
1282671218.468382 socket callback: s=8 e=0x181b808 what=IN Adding data: IN
* expire [0x181b808] 10000ms
1282671218.468426 multi_timer_cb: Setting timeout to 5008 ms
1282671218.468440 1282671218.468446 timer_cb -1 1 / rc:0 run:2
* Operation timed out after 10003 milliseconds with 0 bytes received
* expire [0x17ff468] 0ms
* expire [0x17ff468] 0ms
* Closing connection #0
1282671223.480177 socket callback: s=7 e=0x17ff468 what=REMOVE
1282671223.480217 multi_timer_cb: Setting timeout to 4989 ms
1282671223.480231 1282671223.480237 timer_cb -1 1 / rc:0 run:1
1282671223.480250 REMAINING: 1
1282671223.480266 DONE: http://127.0.0.1/cgi-bin/sleep => (28) Operation timed out after 10003 milliseconds with 0 bytes received
* expire [0x17ff468] 0ms
* Operation timed out after 10003 milliseconds with 0 bytes received
* expire [0x181b808] 0ms
* expire [0x181b808] 0ms
* Closing connection #1
1282671228.471526 socket callback: s=8 e=0x181b808 what=REMOVE
1282671228.471537 1282671228.471539 timer_cb -1 1 / rc:0 run:0
1282671228.471543 REMAINING: 0
1282671228.471546 DONE: http://127.0.0.1/cgi-bin/sleep => (28) Operation timed out after 10003 milliseconds with 0 bytes received
* expire [0x181b808] 0ms

You see that the first call of expire 0 happend after detecting the
timeout. And then expire 0 does not drop the timeout of the second
handle.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-08-24