Repository navigation
Wait until consumed response handlers finish - #539
Open
ShahadatTest wants to merge 3 commits into
Open
ShahadatTest wants to merge 3 commits into
ShahadatTest wants to merge 3 commits into
Conversation
Owner
|
hi @ShahadatTest , Do you have a more real-life example for this error? The tests written are not from this world, I think nobody calls dispatch on the server and nobody uses threadpool. For the first sight, it seems just putting the Zsolt |
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.
HTTPServer.wait()can report success while the final ordered or oneshot response callback is still running: completion is signalled when the expectation is removed. Track callbacks that have been consumed but are still running and signal only after the final one exits. Synchronize selection and callback counts while leaving response callbacks outside the lock, so concurrent responses can still run.The regression tests send real HTTP requests through
http.client.HTTPConnectionto a running server. One test keeps the final response callback open after the request arrives. The threaded-server test starts two requests, lets the second finish and verifies that wait() does not report success while the first callback remains active. This second case is why moving the notification to the end of the last matched dispatch alone is insufficient: an earlier callback can still be running. Both tests cover ordered and oneshot expectations. Events coordinate callback entry/release; no direct dispatch calls or client thread pools are used.These are code-inspection reproductions of a client making requests asynchronously while the test waits for its server callbacks. No personal production incident is claimed.
4 regressions using real HTTP connections fail on untouched upstream. All 22 wait/ordered/oneshot/handler-error/threaded tests pass on Python 3.11/3.12. Ruff, Black, isort, mypy (7 source files) and diff checks pass. The complete suite was not completed locally; the earlier full run was stopped during the long Windows run.
AI assistance: OpenAI Codex found this by code inspection, implemented and tested it at the account owner’s request ("15 TA koro aro"). No independent human review is claimed.