Skip to content

process open fd table is full #38

Description

@traufeisen

During sendRequest the Client checks for the existence of a curl handle in the handle property.
If there is one, it calls curl_reset on it and continues with that handle.
The only way to destroy a curl handle is with the destructor of the Client.

The problem with this is how curl_resetworks.
This function is only resetting the options, but not the underlying socket.
From the curl manual

It does not change the following information kept in the handle: live connections, the Session ID cache, the DNS cache, the cookies and shares.

In long running scripts this leads to more and more open sockets in CLOSE_WAIT status.
Depending on the remote servers.
Until all allowed file descriptors are in use.

The workaround is to construct a new Client object for every request, so the destructor gets called when a request is finished.
A better way would be to explicitely close the handle with curl_close after each request and use a new one for the next request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions