mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4757] [Engine] answer an unexpected handler error with a 500, not a dropped connection #5165
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5165
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4757
Author: @Tsury
Created: 10/30/2026
Status: 🔄 Open
Base:
main← Head:fix-internal-error-500📝 Commits (1)
8a159a6[Engine] answer an unexpected handler error with a 500, not a dropped connection📊 Changes
2 files changed (+83 additions, -1 deletions)
View changed files
📝
serve/server.py(+12 -1)➕
serve/test_internal_error_500.py(+71 -0)📄 Description
Problem and result
When a handler raises something unexpected before the answer starts, such as a
FileNotFoundErrorfrom a cached image file removed under the server, the connection closes with no response. The client can only report ECONNRESET, and the server's reason is not returned to it.After this change, the client gets a 500 with the exception's name, in the Responses error form on
/v1/responses. The traceback goes to the server log and the monitor record.ConnectionErrorandTimeoutErrorstill count as a client that left.BadBodykeeps its handling. An answer that has already started is not replaced.Related discussion
None found in issues or pull requests.
Approach
except OSErrornarrows to(ConnectionError, TimeoutError), so a file error no longer reads as a disconnect. A finalexcept Exceptionwrites the 500 only whenanswer_startedis false.Validation
Passed:
main(870aedd9): 2 errors. With the change: all pass.python -m unittest serve.test_internal_error_500 serve.test_server serve.test_structured: 372 tests pass (Linux, Python 3.14).Not run:
python -m unittest discover -s serveand any GPU or model run. This change was split from a maintained v0.2.8 build that runs on an RTX 5090 Laptop; the unit tests above are the evidence for this branch.Limits
The 500 message carries the exception's name and text. They can include a server-side path.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.