Skip to content

Conversation

@esafak
Copy link
Contributor

@esafak esafak commented Aug 1, 2025

This change addresses an 'OSError: [Errno 24] Too many open files' that occurs when running tox in parallel in projects that use virtualenv.

The error is caused by a file descriptor leak in virtualenv's locking mechanism. This change fixes the leak by ensuring that file locks are properly released.

This change also improves the error message that is displayed when this error occurs, to provide more context and suggest possible solutions.

A new test case has been added to reproduce the error in a controlled way and verify the fix. The test now uses @pytest.mark.skipif to be skipped on Windows.

Fixes #2834

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

google-labs-jules bot and others added 5 commits August 1, 2025 11:40
This change addresses an 'OSError: [Errno 24] Too many open files' that occurs when running tox in parallel in projects that use virtualenv.

The error is caused by a file descriptor leak in virtualenv's locking mechanism. This change fixes the leak by ensuring that file locks are properly released.

This change also improves the error message that is displayed when this error occurs, to provide more context and suggest possible solutions.

A new test case has been added to reproduce the error in a controlled way and verify the fix. The test now uses `@pytest.mark.skipif` to be skipped on Windows.

Fixes pypa#2834

Signed-off-by: Emre Şafak <[email protected]>
This change addresses an 'OSError: [Errno 24] Too many open files' that occurs when running tox in parallel in projects that use virtualenv.

The error is caused by a file descriptor leak in virtualenv's locking mechanism. This change fixes the leak by ensuring that file locks are properly released.

This change also improves the error message that is displayed when this error occurs, to provide more context and suggest possible solutions.

A new test case has been added to reproduce the error in a controlled way and verify the fix. The test now uses `@pytest.mark.skipif` to be skipped on Windows and the `resource` module is imported inside the test function to avoid `ImportError` on Windows.
Signed-off-by: Emre Şafak <[email protected]>
Signed-off-by: Bernát Gábor <[email protected]>
gaborbernat
gaborbernat previously approved these changes Aug 1, 2025
@gaborbernat gaborbernat enabled auto-merge (squash) August 1, 2025 16:11
Signed-off-by: Emre Şafak <[email protected]>
auto-merge was automatically disabled August 1, 2025 16:18

Head branch was pushed to by a user without write access

@esafak esafak requested a review from gaborbernat August 1, 2025 16:24
@gaborbernat gaborbernat merged commit 0c84728 into pypa:main Aug 1, 2025
42 checks passed
@esafak esafak deleted the fix/2834-too-many-open-files branch August 1, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Too many open files"

2 participants