Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Too many open files" error triggered after sending 1000 requests. #44

shulard opened this issue May 9, 2019 · 1 comment


None yet
2 participants
Copy link

commented May 9, 2019


I tried to use the socket-client to upload some data on a server. I've a basic implementation which create a client and inside a foreach loop, I make the upload requests using the Guzzle PSR7 message factory.

foreach ($iterator as $splfileinfo) {
    $response = $this->httpClient()->sendRequest(
        $request = $this->requestFactory()->createRequest(

After 1007 successful requests, I got the Too many open files error and it seems that's the number of opened socket by the client. Is it normal that the socket connexion is never closed after the request is successfully sent (maybe I miss something 😄) ?


This comment has been minimized.

Copy link

commented May 9, 2019

Does the response returns a body ?

This client always stream the body (which means it never read the underlying socket after headers have been received) so maybe it's because you never consume the body returned by the response ?

You can also try to manually close the socket after the reponse has been received by calling $response->getBody()->close();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.