cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-3023840 ] getinfo(CURLINFO_LASTSOCKET) after curl_multi_remove_handle

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 01 Jul 2010 21:38:16 +0000

Bugs item #3023840, was opened at 2010-07-01 16:41
Message generated for change (Settings changed) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3023840&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: crash
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: ygrek (ygreks)
Assigned to: Daniel Stenberg (bagder)
Summary: getinfo(CURLINFO_LASTSOCKET) after curl_multi_remove_handle

Initial Comment:
libcurl segfaults when trying to get CURLINFO_LASTSOCKET after the easy handle was removed from multi handle. Swapping the calls to curl_multi_remove_handle and curl_easy_getinfo makes the crash go away.
Not that it makes much sense to do but anyway :)

Debian testing
$ dpkg -l | grep libcurl
ii libcurl3 7.21.0-1 Multi-protocol file transfer library (OpenSSL)
ii libcurl3-dbg 7.21.0-1 libcurl compiled with debug symbols
ii libcurl3-gnutls 7.21.0-1 Multi-protocol file transfer library (GnuTLS)
ii libcurl4-openssl-dev 7.21.0-1 Development files and documentation for libcurl (OpenSS
$ uname -r
2.6.32-trunk-amd64

The url in code is http://127.0.0.1/ which responds 403. The code is minimally modified examples/multi-single.c

$ gcc -lcurl multi-single.c -o multi
$ ./multi
GNU libc version: 2.10.2 stable
libcurl/7.21.0 OpenSSL/0.9.8m zlib/1.2.3.4 libidn/1.15 libssh2/1.2.5
Segmentation fault
$ gdb ./multi
[...]
(gdb) r
[...]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fa387ed1710 (LWP 1997)]
0x00007fa387aac81c in Curl_getconnectinfo () from /usr/lib/libcurl.so.4
(gdb) bt
#0 0x00007fa387aac81c in Curl_getconnectinfo () from /usr/lib/libcurl.so.4
#1 0x00007fa387aa5fc6 in Curl_getinfo () from /usr/lib/libcurl.so.4
#2 0x00007fa387aa8eeb in curl_easy_getinfo () from /usr/lib/libcurl.so.4
#3 0x0000000000400da0 in main ()

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2010-07-01 23:38

Message:
Thanks for the report. I've fixed the segfault in git now with commit
9be951a41.

This fix might not suit you perfectly though since it does in fact make
the function call not return any socket in this case. The problem is that
libcurl returns the socket to the pool held by the multi handle when you
call curl_multi_remove_handle() and reaching in there and extracting the
file descriptor would not be a good idea methinks.

Case closed!

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3023840&group_id=976
Received on 2010-07-01

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET