cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLE_OPERATION_TIMEDOUT using curl_multi_socket_action

From: Paras S <livetestid_at_live.in>
Date: Mon, 4 Mar 2013 14:58:22 +0530

I am using multi curl in a thread pool architecture in the following manner:
1. Set various options to an easy handle and it to the multi handle.
2. Call curl_multi_socket_action with CURL_SOCKET_TIMEOUT and ev_bitmask as 0.
3. Using the socket callback, I save the socket file descriptor and action required.
4. I add this job to the IO queue.
5. When the job is executed again, call curl_multi_socket_action with the proper socket descriptor and ev_bitmask.
6. If the HTTP transfer is not completed, add the job back to the IO queue. Otherwise, remove the easy handle and process the response.

Steps 1 - 6 occur in various threads of the thread pool, and calls to curl_multi_* are synchronized using locks.
CURLOPT_CONNECTTIMEOUT is set to 30 second.
CURLOPT_TIMEOUT is set to 30 minute (yes, this is normal for the intended operation.)

Here is the problem I am facing:
1. I am using HTTPS to connect to the server. So every time I add the easy handle, steps 5 and 6 are executed multiple times. This is fine if the number of "jobs" is less, but as they increase, I get a CURLE_OPERATION_TIMEDOUT. I am guessing that 30s is not enough for the SSL certificate verification. Is there anyway for me to force libcurl to finish the send operation?

2. In step 6, if I use curl_easy_perform to do some HTTP transfers on the same server, before going to step 1 again. A new connection is established to the server. Is that expected?
Verbose logs:
* Found bundle for host ***.com: 0x7fffe414c6a0
* About to connect() to ***.com port 443 (#3)

PS:
I am using libcurl 7.29.0
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-04