Skip to content

Make sure to drain the request stream#104

Closed
muhamadazmy wants to merge 1 commit intomainfrom
pr104
Closed

Make sure to drain the request stream#104
muhamadazmy wants to merge 1 commit intomainfrom
pr104

Conversation

@muhamadazmy
Copy link
Copy Markdown
Contributor

@muhamadazmy muhamadazmy commented Mar 18, 2026

Make sure to drain the request stream

Summary:
This PR makes sure the input request stream is drained before
the output stream is closed/dropped. This make sure stream
is closed gracefully with no errors.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 18, 2026

Test Results

  7 files  ±0    7 suites  ±0   3m 13s ⏱️ -3s
 47 tests ±0   47 ✅ ±0  0 💤 ±0  0 ❌ ±0 
200 runs  ±0  200 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 8d42d88. ± Comparison against base commit 3dfa923.

♻️ This comment has been updated with latest results.

@tillrohrmann
Copy link
Copy Markdown
Contributor

Fyi there is a similar PR already open #102.

@muhamadazmy
Copy link
Copy Markdown
Contributor Author

muhamadazmy commented Mar 18, 2026

Oh, sorry I missed this one out! The timeout in #102 is a good touch! Feel free to compare the 2 approaches. I don't mind either to be merged. (I would probably need to add timeout handling as well)

@muhamadazmy muhamadazmy force-pushed the pr104 branch 2 times, most recently from 4b2a49b to df1d9e9 Compare March 18, 2026 10:54
@muhamadazmy
Copy link
Copy Markdown
Contributor Author

muhamadazmy commented Mar 18, 2026

@tillrohrmann I couldn't resist but updating my PR to also implement timeout 🙈 , also fixed a subtle issue that caused the future to hang indefinitely if the stream was reset.

This PR is now identical to yours in behaviour but with more code 😆

Again, feel free to merge yours (I have tested it) with and without H2 Pool

The only benefit of my change is that the draining is part of the HandlerStateAwareFuture, so draining can't be missed if the code was ever refactored. In other words, you don't need to do manual draining after the future is complete.

Summary:
This PR makes sure the input request stream is drained before
the output stream is closed/dropped. This make sure stream
is closed gracefully with no errors.
@tillrohrmann
Copy link
Copy Markdown
Contributor

I'll leave it up to @slinkydeveloper to decide which PR to merge. Both are doing the same thing ultimately. Your approach is to add it directly to the HandlerStateAwareFuture where in my PR #102 I added it as a separate step.

@slinkydeveloper
Copy link
Copy Markdown
Contributor

Sorry @muhamadazmy i went with less code :)

@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2026
@muhamadazmy muhamadazmy deleted the pr104 branch March 27, 2026 11:31
@muhamadazmy
Copy link
Copy Markdown
Contributor Author

@slinkydeveloper No worries man! 😄 It makes sense

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants