Repository navigation
Make the high fd test really disable garbage collection - #880
Conversation
Automation signalsActivity patterns show signs of automation. Evidence
Last 5 PRs:
This is an automated analysis by AgentScan |
e50806f to
8817f52
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #880 +/- ##
=======================================
Coverage 75.98% 75.99%
=======================================
Files 41 41
Lines 4931 4932 +1
Branches 561 561
=======================================
+ Hits 3747 3748 +1
Misses 1045 1045
Partials 139 139 |
8817f52 to
87af310
Compare
webknjaz
left a comment
There was a problem hiding this comment.
Alright, sounds like I misunderstood how pypytools works the first time I plugged it in. Perhaps it deserves a contrib change note, still?
|
I legitimately felt like it might just be broken, at first... but yeah I guess it is just misleading what it does |
|
@rm-you yeah, I think it's very likely that I got confused and the shim seemed to have been solving the issue cross-platform at the time. But it's not very well documented. Could you also include dropping it from the deps lists? (except for the lock files, I'll regenerate them after the merge) |
|
Feel free to use separate atomic commits on the topic branch — I almost always use true merge in this repo. |
test_high_number_of_file_descriptors needs the server to accept its connection on a file descriptor above the limit, so nothing may free a lower one while it runs. Its _garbage_bin fixture was meant to stop garbage collection, but pypytools' DefaultGc.nogc() only pauses the collections that DefaultGc's own hooks start. Nothing enables those hooks, and CPython has none to install, so the interpreter's collector kept running. This matters once stopped servers can be collected (cherrypy#858): a collection then closes the open sockets of test clients that fixtures attached to a server, and the server can take one of the freed low file descriptors. That failed the test once on CPython 3.14 in CI. The fixture now disables the collector through the gc module, which CPython and PyPy both support, and turns it back on afterwards. A fixture's code after its yield runs even when the test fails, so it needs no try/finally. Nothing else uses pypytools, so drop it from the test dependencies and from the pylint hook's environment. The lock files still pin it until they are regenerated. Assisted-By: Anthropic Claude Opus 5.5 Signed-off-by: Adam Harwell <flux.adam@gmail.com>
|
Sure, will drop those |
87af310 to
8a119ff
Compare
Note
This is the first PR of the statistics stack: #880 → #858 → #881. The later PRs contain its commit until it merges. The thread pool fixes are a separate stack: #859 → #882.
What kind of change does this PR introduce?
What do these changes do?
test_high_number_of_file_descriptorsneeds the server to accept its connection on a file descriptor above the limit, so nothing may free a lower one while it runs. Its_garbage_binfixture was meant to stop garbage collection, butDefaultGc().nogc()frompypytoolsonly pauses the collections thatDefaultGc's own hooks start. Nothing enables those hooks, and CPython has none to install, so the interpreter's collector kept running:The fixture now calls the
gcmodule itself, and turns the collector back on afterwards. Split out of #858 as asked there: #858 makes stopped servers collectable, and a collection during this test then closed the sockets of test clients attached to a server. That failed the test once on CPython 3.14.Nothing imports
pypytoolsany more, so this PR also drops it fromdependencies/direct/py.inand from the pylint hook's dependencies. The lock files still pin it until they are regenerated.Are there changes in behavior for the user?
No. Tests only.
Is it a substantial burden for the maintainers to support this?
No. The fixture uses the standard library's
gcmodule instead of a third-party context manager.Related issue number
Needed by #858.
Checklist
Tip
New to open source contributions? Making a lovely PR is a great read.
and description in grammatically correct, complete sentences
docs/) and inline docstrings reflect the changes(see good commit messages)
(can be done once the PR number is known; alternatively, you can
use a related issue number if one exists)
code of conduct
This change, its tests and this description were written by an AI agent (Anthropic Claude Opus 5.5) on behalf of Adam Harwell (@rm-you). Tested locally with Python 3.11: the complete suite passes at the top of this stack (223 passed, 3 existing expected failures) and with both stacks merged (232 passed), each PR's new tests fail on the commit below it, and all pre-commit hooks pass on the changed files, including
mypy-stubtest. Another Claude agent reviewed the changes before they were split into two stacks.🤖 Generated with Claude Code