-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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(http): panic when responding to a closed conn #12216
fix(http): panic when responding to a closed conn #12216
Conversation
Our oneshot receiver in `HyperService::call` would unwrap and panic, the `.await` on the oneshot receiver happens when the sender is dropped. The sender is dropped in `op_http_response` because: 1. We take `ResponseSenderResource` 2. Then get `ConnResource` and early exit on failure (conn already closed) 3. The taken sender then gets dropped in this early exit before any response is sent over the channel Fallbacking to returning a dummy response to hyper seems to be a fine quickfix
Fix LGTM, is it possible to add a test for this? A stand-alone test is here: https://github.com/denoland/deploy/issues/1949#issuecomment-926873141 |
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.
It seems hard to reliably trigger just this bug without sometimes triggering another issue.
I don’t want to land flaky tests.
And I like bugs to be fixed one at a time.
Therefore I think we can ship this as-is.
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.
We should have a test. Even a flaky test is better than none - tho a solid one would be great.
I've added a non-flaky test. You can run it yourself:
|
must have non-empty catch branch
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.
LGTM - nice work!
Our oneshot receiver in
HyperService::call
would unwrap and panic, the.await
on the oneshot receiver errors when the sender is dropped.The sender is dropped in
op_http_response
because:ResponseSenderResource
(which owns the sender)op_http_response
due to the conn being closedFallbacking to returning a dummy response to hyper seems to be a fine quickfix