Repository navigation
fixtures: raise the test server's accept backlog - #167
Open
abu-tahir-0 wants to merge 1 commit into
Open
abu-tahir-0 wants to merge 1 commit into
abu-tahir-0 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #159.
Problem
test_a_correct_server_passes_every_rule_and_names_the_evidenceand its neighbours fail intermittently underpytest -n auto. The failure is not the rule seeing the wrong state: the evidence subprocess dies atconnect()withConnectionResetError: [Errno 54] Connection reset by peerwhile the fixture server is still serving the scan's own requests, so the rule reportsINDETERMINATEand the test compares that withPASS.Root cause
The fixtures are
ThreadingHTTPServerinstances, andsocketserver's defaultrequest_queue_sizeis 5. On macOS a connection is reset rather than left queued once the accept queue is full, and under xdist the server's accept loop competes with the client half of the same worker and five other workers. The reset is therefore a property of the fixture's listening socket, not of any shared rule state.Fix
Use a
ThreadingHTTPServersubclass withrequest_queue_size = 128for every fixture served byserver.common.serve, with a comment recording why.Testing
pytest tests/harness/test_graybox.py -m unit -q -n auto -p no:randomlyin a loop: 9/30 runs failed, all on the reset path above (different parametrisations each time).ruff check/ruff format --check— clean.Note: local runs needed
NO_PROXY=localhost,127.0.0.1because httpx 0.28 rejects this machine'sNO_PROXYcontaining[::1]; that is unrelated to this change.