libev callbacks getting called for same socket fd and same event

Zsbán Ambrus ambrus at
Wed Jan 11 09:56:21 CET 2012

On Wed, Jan 11, 2012 at 5:29 AM, Sandeep <sandeep at> wrote:
> What I mean is, when libev
> notify's me I have to call libcurl again with that socket fd and event.
> Further libcurl actually performs read/write operation on the fd. Though I
> am doing this, libev is repeatedly calling me with same socket fd and event,
> recursively. Thus some of my fd's will never be completed, thus getting
> stuck.

I have previously tried to use libcurl in a libev loop.  I have seen a
busy loop with _time_ events (because libcurl does not believe me that
the timeout has already been past), but not with io handles.  If you
would like to see my source code, tell me.

Anyway, to debug your problem, it might help if told us more about the
circumstances.  For example,
1. what full version of curl you are using (including the ssl and name
resolution library, if any, eg. the output of curl --version);
2. how many curl handles and of what protocol (eg. HTTP or FTP) are
you running;
3. what options are you setting to those curl handles and the curl
multi handles;
4. in what stage do you encounter these loops (is it for the very
first download or much later, during name resolution, sending headers,
sending post data, receiving headers, receiving results), on what io
handle and is it for reading or writing;
5. debug logs of your program that shows what happens, eg. output from
the CURL_VERBOSE setting, or output from debug printfs you add to your
6. your source code if possible.


More information about the libev mailing list