cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl_multi_remove_handle closes easy handle, causes crash

From: Hauke Duden <h.ns.duden_at_gmx.net>
Date: Thu, 11 Mar 2010 17:45:46 +0100

Hello all,

I am having a problem with libCURL. What happens is this:

1) I configure an easy request for an FTP transfer(!). It works if
this is HTTP.
2) add it to a multi object
3) perform the request
4) remove it from the multi object

5) take the same easy handle and configure another FTP request
6) add it to the same multi object again
7) perform the request again
8) remove it from the multi object
9) close the easy handle

In step 9 there will be a crash. The reason seems to be that in step 8
the easy handle is closed by curl_multi_remove_handle (more
specifically, in add_closure). And thus, closing the handle again in 9
will cause a crash.

Also, if I leave out steps 5-8 and directly close the handle after 4
then NO crash occurs.

If I have not misunderstood the docs then curl_multi_remove_handle
should never close the handle that it removes. So this seems to be a
bug.

It seems to be an artifact from the connection sharing. I don't
understand the algorithm properly, but it seems to me that the
algorithm thinks that the handle is one that was only kept open so
that the connection can remain in the sharing pool. Which is incorrect
since the handle is still in active use by the program.

 From the looks of it, a similar problem was already sent to the list
by someone else last year. See:

http://curl.haxx.se/mail/lib-2009-07/0249.html

I am uncertain if this is actually the same bug, however.

I need to find a solution to this problem quickly (even if it is only
a workaround). Any suggestions would be greatly appreciated.

Thanks and best regards,

Hauke

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