Skip to content

Fix error logging when sending 503 response fails#825

Open
avinashkamat48 wants to merge 2 commits into
cherrypy:mainfrom
avinashkamat48:codex/serve-unservicable-error-log
Open

Fix error logging when sending 503 response fails#825
avinashkamat48 wants to merge 2 commits into
cherrypy:mainfrom
avinashkamat48:codex/serve-unservicable-error-log

Conversation

@avinashkamat48

Copy link
Copy Markdown

Summary

  • replace the invalid self.server.error_log call in HTTPServer._serve_unservicable()
  • add a focused regression test for exceptions raised while sending the polite 503 response

Verification

  • python -m pytest cheroot/test/test_server.py::test_serve_unservicable_logs_simple_response_errors -q (test passed; command exited nonzero because single-test coverage is below the repo-wide fail-under threshold)
  • git diff --check

Closes #797

@read-the-docs-community

read-the-docs-community Bot commented Jun 11, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.28%. Comparing base (2ffb0ba) to head (a8a068b).
⚠️ Report is 5 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #825      +/-   ##
==========================================
- Coverage   78.32%   78.28%   -0.04%     
==========================================
  Files          41       41              
  Lines        4788     4817      +29     
  Branches      547      547              
==========================================
+ Hits         3750     3771      +21     
- Misses        900      907       +7     
- Partials      138      139       +1     

@julianz-

julianz- commented Jun 20, 2026

Copy link
Copy Markdown
Member

@avinashkamat48 Thanks for this PR. There are a few housekeeping issues here:

  1. The function _serve_unservicable() has a spelling mistake (should be unserviceable) which is not your fault but I have changed the PR title to avoid repeating the same error. I am not suggesting we change the name in the code in this PR - just that we don't repeat its use in comments and titles if we can avoid it.

  2. There is a description template with a checklist for PRs which @webknjaz would like us to use.

  3. You need to add a docs/changelog-fragments.d/825.bugfix.rst describing the bug fix here in the appropriate towncrier style - see docs/changelog-fragments.d/README.rst.

  4. The commit is missing a body. You can see this in the CI log:

https://github.com/cherrypy/cheroot/actions/runs/27353939982/job/80822995068?pr=825

Commit 5ef1cb8897:
3: B6 Body message is missing
  1. git diff --check in your "Verification" section would only check for white space issues that pre-commit already checks for so this is not a meaningful test.

@julianz- julianz- changed the title Log unservicable response errors on HTTPServer Fix error logging when sending 503 response fails Jun 20, 2026
@julianz- julianz- self-assigned this Jun 20, 2026
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.

Replace self.server.error_log() with self.error_log() in HTTPServer._serve_unservicable()

2 participants