cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLE_OPERATION_TIMEDOUT while connecting.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 26 Apr 2012 19:44:16 +0200 (CEST)

On Thu, 26 Apr 2012, Evgeny Turnaev wrote:

> I am trying to make use of pycurl with multi interface + pyev and there
> are some issues i dont understand from docs:

And with multi interface you mean the multi_socket API as I understand it.

> I am not planning to use curl timeout system but to use libev timers and
> manually remove_handle from multi when timeout happens.

Sorry, but I don't understand how. What timeout values will you use if you
don't use the ones libcurl provide? Also, I really strongly advice you to use
the timeout callback to get the timeout info. I think you'll see that it is
the smoothest path forward when using the multi_socket API.

> 1) I create curl and and handle to multi with multi.add_handle(c) but
> if dont call multi.socket_action(pycurl.SOCKET_TIMEOUT, 0) nothing
> fetches.

Exactly. Because you ignore libcurl's timeouts you don't call libcurl properly
on the timeout that it has set, so you do it blindly instead and happens to
get the same effect.

> But there is also multi.socket_all() witch is seems to be doing the same?

It doesn't do the same, but in this case the end result will be the same.

> Is there any difference in calling
> multi.socket_action(pycurl.SOCKET_TIMEOUT, 0) or multi.socket_all()
> What is cheaper?

The first is MUCH cheaper, as the second will act on every single handle that
you have added and the first will only act on the handles that actually have
timed out. curl_multi_socket_all() is also deprecated so you really shouldn't
use it.

> 2) the main question: when a keepalive socket timeout outed and curl thinks
> connection is dead and tells so via error list of multi.info_read() do i
> have to manually start another Curl() instance in order to fetch url
> finally? (i thought curl will just ask for another socket)

A timeout error is an error that will stop that particular transfer. If you
want to start another transfer on that handle, you need to remove it and
re-add it to the multi-handle.

> Does creating pool of curls will somehow help in such situation?

I'm not following what you're asking here so I don't know.

> CURLE_OPERATION_TIMEDOUT means connect timeout or fetch timeout or both? Can
> it be related to any other?

It means it reached a timeout value internally. I think the error code is
restricted to only be returned if one of the user provided limits are reached.

> Why Connection #0 gets closed 2 times?

I don't know, I don't think there was enough details for me to figure out what
was really going on there.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-04-26