#46756 [Ver->Csd]: curl_copy_handle crashes with curl_multi
ID: 46756
Updated by: magicaltux@php.net
Reported By: kyle at ifixit dot com
-Status: Verified
+Status: Closed
Bug Type: cURL related
Operating System: *
PHP Version: 5CVS, 6CVS (2008-12-08)
New Comment:
This bug has been fixed in libcurl's CVS.
Snapshots of libcurl's sources are packaged every day; this change
will be in the next snapshot. You can grab the snapshot at
http://cool.haxx.se/curl-daily/.
Thank you for the report, and for helping us make libcurl and PHP
better.
Previous Comments:
------------------------------------------------------------------------
[2008-12-11 07:56:17] magicaltux@php.net
Confirmed against curl 7.19.2 and more debug data posted to libcurl's
bug tracker.
https://sourceforge.net/tracker/index.php?func=detail&aid=2416182&group_id=976&atid=100976
------------------------------------------------------------------------
[2008-12-11 07:18:50] magicaltux@php.net
This bug has been reproduced without PHP by reproducing the same
sequence in C.
$ svn co http://ookoo.org/svn/snip/curl_bug
...
$ cd curl_bug
$ make
...
$ gdb ./curl_bug
...
#0 0x00007f81692626c9 in ?? () from /usr/lib/libcurl.so.4
#1 0x00007f8169263ec4 in ?? () from /usr/lib/libcurl.so.4
#2 0x00007f816926444c in Curl_connect () from /usr/lib/libcurl.so.4
#3 0x00007f81692721ba in ?? () from /usr/lib/libcurl.so.4
#4 0x00007f8169272a6e in curl_multi_perform () from
/usr/lib/libcurl.so.4
#5 0x0000000000400b34 in main (argc=1, argv=0x7fff716a14d8) at
test.c:36
I'll build latest curl with debug mode, check if this can be
reproduced, and if so, I'll open a but on libcurl providing more debug
informations.
------------------------------------------------------------------------
[2008-12-10 19:32:11] magicaltux@php.net
I checked the origin of the crash, and it seems that libcurl does NOT
behave good if you duplicate a handle while it's part of a curl_multi.
Calling curl_multi_remove_handle($mh, $conn[$i]); before $conn2[$i] =
curl_copy_handle($conn[$i]); fixes the issue.
Checking curl's documentation, I found it to be quite picky about
processing order. I believe this is either a bug in libcurl, or a
"feature".
libcurl's manpages are not providing exact informations about calling
curl_easy_duphandle() on a curl handle part of a curl_multi.
I'm going to investigate this more and either fix this bug (by
providing a patch) or mark it as bogus (if this is a curl feature).
------------------------------------------------------------------------
[2008-12-08 11:33:38] jani@php.net
Verified with latest CVS + Curl 7.18.2
------------------------------------------------------------------------
[2008-12-07 16:45:51] kyle at ifixit dot com
Reproducible using libcurl/7.19.2 OpenSSL/0.9.8b zlib/1.2.3
libidn/0.6.5
on kernel 2.6.18-53.1.14.el5. This is not a new bug-- also reproducible
with PHP 5.2.6 and an older version of libcurl.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/46756
--
Edit this bug report at http://bugs.php.net/?id=46756&edit=1
Thread (9 messages)