Fix crash when a HTTP/2 client goes away on SSE streams#5738
Merged
Conversation
…ite after handler finished if tail call has completed. Replace CloseNotify() with the request context's Done() channel, as CloseNotify is deprecated.
Contributor
|
Surge PR preview deployment was removed |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5738 +/- ##
==========================================
- Coverage 21.47% 21.45% -0.02%
==========================================
Files 428 428
Lines 38597 38603 +6
==========================================
- Hits 8288 8283 -5
- Misses 29544 29555 +11
Partials 765 765 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
qwerty287
approved these changes
Nov 13, 2025
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.
The issues reported at #4848 and duplicates seem to be caused by HTTP/2 clients going away while using the SSE streaming endpoints.
This PR fixes #4848 the "Write called after Handler finished" panics by moving the EOF signaling to the main routine to avoid writes after the handler has finished.
In addition, for both EventStreamSSE and LogStreamSSE functions, the request context is now used to determine if the client has disconnected, as CloseNotify is deprecated and should be replaced by the request context.