Fix connection errors during body reads#964
Merged
rgalanakis merged 1 commit intomainfrom Jun 8, 2025
Merged
Conversation
4128634 to
56a2d6d
Compare
For a long time, we've been plagued by errors in Sentry due to errors when reading an HTTP body (not on the initial connection). Now that we have an in-process http server for testing, I was able to reproduce this problem using some rack hijacking. This also meant removing Thin for Puma (thin doesn't support rack.hijack). The fix was sort of obvious- wrapping the body-reading portion of the code in the same sort of exception handling that the initial connection uses. Refactor the in-process http server into a spec helper module so it can be reused elsewhere.
56a2d6d to
636d52a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #964 +/- ##
==========================================
+ Coverage 97.03% 97.08% +0.04%
==========================================
Files 487 488 +1
Lines 30994 31035 +41
==========================================
+ Hits 30076 30129 +53
+ Misses 918 906 -12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
For a long time, we've been plagued by errors in Sentry due to errors when reading an HTTP body (not on the initial connection).
Now that we have an in-process http server for testing, I was able to reproduce this problem using some rack hijacking. This also meant removing Thin for Puma (thin doesn't support rack.hijack).
The fix was sort of obvious- wrapping the body-reading portion of the code in the same sort of exception handling that the initial connection uses.
Refactor the in-process http server into a spec helper module so it can be reused elsewhere.