curl-library
curl_multi_remove_handle possibly broken
Date: Fri, 23 Aug 2013 12:26:46 -0700
Hi;
I'm trying to incorporate libcurl with boost::asio by following the
examples in libcurl.
When I scan the messages using curl_multi_info_read() and check for
CURLMSG_DONE,
I remove the handle (say handle x) from the message queue using;
curl_multi_remove_handle(),
but I don't call curl_easy_cleanup() since the handle x will be re-used.
Then here's what happens;
1) further calls into curl_multi_info_read() *still* returns handle X. As
if 'curl_multi_remove_handle'
did not take effect.
2) Later, a curl_easy_cleanup() is issued for the handle. Application
decides not to reuse the handle.
3) Then, asio sends an event for the same socket such as CURL_POLL_OUT. If
I call into curl_multi_socket_action(),
then I get this;
lib/multi.c ( line 2205 )
if(data->magic != CURLEASY_MAGIC_NUMBER) {
/* bad bad bad bad bad bad bad */
return CURLM_INTERNAL_ERROR;
}
If I try adding 'curl_easy_cleanup()' immediately after
curl_multi_remove_handle(), then I get the same error.
But if I disable CURLMOPT_PIPELINING, things work fine. It seems like
pipelining breaks the easy handle / socket
management in libcurl where the handles are referenced/kept when they
shouldn't be.
Or if the user shouldn't remove/delete in-use pipelined handles, then how
is this communicated to the user? Is there any
way for me to ask libcurl when it is safe to remove/delete (or postpone)
these actions?
Cheers,
Tolga Ceylan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-08-23