Fix unservicable connection error logging#830
Open
andrewkernel wants to merge 3 commits into
Open
Conversation
60b82ae to
d179d6e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #830 +/- ##
==========================================
+ Coverage 78.09% 78.33% +0.24%
==========================================
Files 41 41
Lines 4788 4810 +22
Branches 547 547
==========================================
+ Hits 3739 3768 +29
+ Misses 910 903 -7
Partials 139 139 |
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.
❓ What kind of change does this PR introduce?
📋 What is the related issue number (starting with
#)Resolves #797
❓ What is the current behavior?
HTTPServer._serve_unservicable()callsself.server.error_log()whenHTTPRequest.simple_response()raises an unexpected exception, butHTTPServerdoes not have aserverattribute. That means the 503 handler's error logging path raises another exception instead of logging the original failure.❓ What is the new behavior?
The 503 handler now calls
self.error_log(), matching otherHTTPServerlogging paths. A focused regression test covers the unexpected-error branch and verifies that the connection is still marked for linger/close.📋 Other information:
Verification:
python -m py_compile cheroot/server.py cheroot/test/test_server.py.\.venv\Scripts\python.exe -m pytest cheroot/test/test_server.py -k unservicable -q --no-cov.\.venv\Scripts\python.exe -m pytest cheroot/test/test_server.py::test_stop_interrupts_serve cheroot/test/test_server.py::test_unservicable_conn_logs_unexpected_response_errors -q --no-covThe targeted pytest selection also passes under the repository config, but the repo-wide coverage threshold fails when only this single test is selected; the
--no-covruns above verify the regression locally.📋 Contribution checklist: