-
Notifications
You must be signed in to change notification settings - Fork 32
♻️🐛 Fix: Prevent aiohttp.http_exceptions.LineTooLong and improve diagnostics
#8174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
♻️🐛 Fix: Prevent aiohttp.http_exceptions.LineTooLong and improve diagnostics
#8174
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #8174 +/- ##
==========================================
- Coverage 89.71% 87.93% -1.79%
==========================================
Files 1709 1476 -233
Lines 66465 60655 -5810
Branches 825 631 -194
==========================================
- Hits 59632 53338 -6294
- Misses 6617 7095 +478
- Partials 216 222 +6
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
aiohttp.http_exceptions.LineTooLong and improve diagnostics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors exception handling to prevent aiohttp.http_exceptions.LineTooLong errors by avoiding inappropriate use of the reason field in HTTP status lines. The PR systematically replaces reason fields with details across exception classes and improves error context to prevent malformed HTTP responses.
- Rename exception context fields from
reasontodetailsto prevent leakage into HTTP status lines - Update HTTP exception handling to use
textinstead ofreasonfield - Strengthen error handling around HTTP client interactions with director-v2
Reviewed Changes
Copilot reviewed 46 out of 46 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| exception_handling/_factory.py | Update default exception handler template to use text instead of reason |
| rest_middlewares.py | Fix HTTP status setting to use proper reason parameter |
| director_v2/_client_base.py | Strengthen director-v2 client error handling with better context |
| Multiple error classes | Rename reason field to details in exception message templates |
| login/_controller/rest/auth.py | Replace reason parameter with text in HTTP exceptions |
services/web/server/src/simcore_service_webserver/projects/exceptions.py
Outdated
Show resolved
Hide resolved
matusdrobuliak66
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the effort 👍
sanderegg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fun! thanks
…eptions.py Co-authored-by: Copilot <[email protected]>
|
@Mergifyio queue |
🟠 Waiting for conditions to match
|
|



What do these changes do?
Despite previous attempts to mitigate
aiohttp.http_exceptions.LineTooLongat theweb.HTTPExceptionlevel, this error still appears sporadically in production logs. Unfortunately, current logging lacks the necessary context to trace the root cause.Log analysis from test deployments suggests the issue may originate from exceptions raised by the HTTP client communicating with
director-v2. This PR reinforces that interaction and introduces refactorings to reduce the likelihood of malformed responses triggering the error.Changes:
reasonfield inaiohttp.web.HTTPException(gets used as HTTP status line); usetextinstead.reasonkey to prevent leakage into HTTP status lines.reasontodetailsfor clarity and to prevent misuse.director-v2.Related issue/s
How to test
Dev-ops