curl-and-python

Re: CURLE_OPERATION_TIMEDOUT while connecting.

From: Evgeny Turnaev <turnaev.e_at_gmail.com>
Date: Fri, 4 May 2012 10:44:21 +0400

2012/5/3 Utsav Sabharwal <tashywashysachy_at_live.in>:
>> In other words when i call setopt(pycurl.TIMEOUT, 5) a time diff will
>> be calculated with now or with some stored value?
>
>
> It means if your  pycURL function doesn't execute within 5 seconds, time out
> error shall be raised.
>
>
>> The reason i am asking is because it is seems all owrking ok with
>> multi.socket_action(pycurl.SOCKET_TIMEOUT, 0) when i do not set
>> timeouts ( setopt(pycurl.TIMEOUT, 5) and setopt(pycurl.CONNECTTIMEOUT,
>> 1) )
>
>
> Are you trying to say setting pycurl.TIMEOUT as 0 your code run smoothly but
> it gives time out error when you set it to 5?

No when i dont set timeout at all.

>
> If yes, please note CURLOPT_TIMEOUT is the maximum number of seconds to
> allow cURL functions to execute. Default timeout is 0 (zero) which means it
> never times out.
>
>
> Reference: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTTIMEOUT
>
>
>> >>  Another option for me would be - to set some high timeouts that i know
>> >> is
>> >> not going to be reached (i will remove handle earlier). But the thing
>> >> that
>> >> bothers me in this solution is an issue from previous letter: after 130
>> >> seconds of idle i added fresh new handle to multi and info_read said
>> >> that it
>> >> is timed out. Could you please explain me this behavior - is it an
>> >> error in
>> >> my code?
>
> I am not sure if their is an error in your code or pycurl. The debug
> says: <130 seconds later whan keepalive sockets is closed by remote>
> which means the connection was forcefully closed by the remote server (the
> server you made request to). May be the server dont wish you to connect in
> way you wish to.
>
> If still the question seems unresolved can you please elaborate? Why dont
> you write a working snippet with sample inputs presenting unexpected pycurl
> observation? I am sure once I am clear with your situation, I would be able
> to help :)
>
>
> Are you referring to your code you shared in the previous
> email? (http://pastebin.com/bEK8Twqe)
>

Yes i am referring to this code snippet. I still think the question is
unresolved because it looks like a libcurl/pycurl bug to me.
I think issue is ether connected to fact that i am not calling any
curl api for 130 seconds ether to fact that there are 4 connections
and #1 survived while other died.
Obviously a newly added curl with timeouts set to 1 and 5 seconds cant
expire just after adding curl.

Daniel, no i dont think this is dns resolving error because debug show
newly added curl timed outed in a 1 ms (in fact earlier as python
logging is slow as hell).

I personally can live with this issue for now as i am not going to use
curl timouts, but i am just trying to point that there is something
wrong to make libcurl/pycurl better to save others time not hitting
this issue.

>
>
>
>
>
> d_r_a_g_o_s
>
>
>
> Are you following us on twitter? @pycurl
>
>
>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>

-- 
--------------------------------------------
Турнаев Евгений Викторович
+7 906 875 09 43
--------------------------------------------
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2012-05-04