WordPress / WordPress/Requests

Failed to open stream: Too many open files in Requests.php

Open
#257 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.6k
Forks
500
Avg merge
2d 21h
Merged PRs (30d)
5

Description

While using Requests in a script that shoots out multiple thousands of requests, I get the following error:

PHP Warning:  require_once(/.../Requests/Exception.php): failed to open stream: Too many open files in /.../Requests.php on line 136
PHP Fatal error:  require_once(): Failed opening required '/.../Requests/Exception.php' (include_path='.:/usr/local/lib/php:/var/www/...') in /.../Requests.php on line 136

I believe this indicates that file handles are not being closed properly.

NOTE: This happens when using the cURL transport only, switching to fsockopen mitigated the issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Requests.php line 136 and inspect how the cURL transport manages resources across multiple thousands of requests; compare its behavior with the fsockopen transport, which mitigates the issue. Reproduce the failure with repeated cURL requests and verify that the run no longer reaches the "Too many open files" error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.