cURL / Mailing Lists / curl-library / Single Mail

curl-library

Serious bug in libcurl multi (negative running) with reproduction code

From: <billludwig_at_fastmail.fm>
Date: Wed, 1 Dec 2010 09:06:00 -0500

Hello.
I have found interesting bug in multi libcurl interface.
It is serious, because as result of this bug, program can enter infinite
loop, hanging
execution of whole program.
Distinctive feature of this bug is, that "running" becomes negative
without being equal to zero.
Example:
still_running=4
still_running=4
still_running=3
still_running=1
still_running=-2
still_running=-4
still_running=-6
still_running=-8
still_running=-10
...

program enters infinite loop despite the fact that all easy handles are
"finished" (some with timeouts)

I can easily correct bug just changing the main loop to:
while(still_running>0)
But this is ugly because there is bug somewhere inside of libcurl.
It is not easy for me to find it because I'm not familiar with libcurl
sources, but it will be easy for you guys :)

I can reproduce this bug in ~70% of cases, on 64bit and on 32bit linux.
How to reproduce:

c-ares-1.7.3 (required):
./configure --enable-debug --disable-optimize --enable-curldebug
--disable-symbol-hiding

curl-7.21.2:
./configure --enable-debug --disable-optimize --enable-warnings
--enable-curldebug --enable-ares=/usr/local/lib --disable-ipv6
--disable-threaded-resolver

Source code in attachment.
Just run it. If its finished - bug missed. If its stuck printing
still_rinning=-... its a bug

By the way, bug is closely related to urls used for curling. If those
urls change, bug can disappear ..
I tried it with different combination of urls, it disappears ... So its
better to try it now while it works.

-- 
  
  billludwig_at_fastmail.fm
-- 
http://www.fastmail.fm - Access your email from home and the web


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2010-12-01