cURL / Mailing Lists / curl-library / Single Mail

curl-library

(no subject)

From: <pjoshi_at_servowatch.co.uk>
Date: Sun, 1 Jul 2012 09:32:42 +0100

Thanks Jeff for your advice. After going through stack trace in visual
studio, by doing a break all,
 This is what was actually happening.
 1. I was using same curl_handler for 3 requests, one for creating a
session and next 2 for getting responses, from two other web service
operations.
 2. After the first request as described in my earlier email,
 3. Now in the second and third request I was using writer callback
functions through CURL_EASYSETOPT to write the received contents in
buffer, which was internally using write system call. The code was getting
stuck up (hang state) here itself without crashing.
 4. first request which I was using is to create a session with user
credentials being passed in request and using the same cookies in next 2
requests.

Workaround:
 1. I didnt make any changes in writer function and instead of calling it
in second and third request through CURL_EASY_SETOPT, i associated the
writer function with the first request and it worked.

 Daniel: As per your email, the libcurl version we are using, is 7.26.0.
Possibly i dont know any issue in server side, as that has been developed
by a vendor of ours. Also i forgot to mention that code did use to run
for 45 minutes, without any issue. It was after first 45 minutes, that
issue would surface. Strange. Neways, the workaround mentioned above, did
work as after that, we could run the code continuously for 41 hours.

 Regards,

 Preetam.

> My suggestion would be to use CURLOPT_DEBUGFUNCTION to enable logging,
and in the
> debug function, print out or otherwise log the data received to find out
how far the
> library is getting.
> On 6/29/2012 3:19 AM, pjoshi_at_servowatch.co.uk wrote:
>> Hello, I am using libcurl with my C++ program on Visual Studio 2010
environment and my code hangs on curl_easy_perform inspite of
specifying
>> timeout.
>> curl_handler = curl_easy_init(); //Curl handler
>> initialization.
>> if(curl_handler) {
>> curl_easy_setopt(curl_handler, CURLOPT_HTTPHEADER, header);
>> curl_easy_setopt(curl_handler, CURLOPT_URL,url_ptr);
>> curl_easy_setopt(curl_handler, CURLOPT_POSTFIELDS, xmlstuff);
curl_easy_setopt(curl_handler, CURLOPT_NOSIGNAL,0);
>> curl_easy_setopt(curl_handler, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_easy_setopt(curl_handler, CURLOPT_COOKIEFILE, "cookiefile.txt");
curl_easy_setopt(curl_handler, CURLOPT_COOKIEJAR, "cookiefile.txt");
curl_easy_setopt(curl_handler, CURLOPT_CONNECTTIMEOUT_MS,6000);
response = curl_easy_perform(curl_handler);
>> /*Other Logic follows*/
>> }
>> Any clues ?
> ------------------------------------------------------------------- List
admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-07-01