-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
http: fix segfault when idle timer fires before request headers received. #3970
Conversation
…ved. Risk Level: Low Testing: New unit test. Signed-off-by: Harvey Tuch <[email protected]>
Signed-off-by: Harvey Tuch <[email protected]>
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.
Thanks for jumping on this.
@@ -419,7 +419,7 @@ void ConnectionManagerImpl::ActiveStream::resetIdleTimer() { | |||
void ConnectionManagerImpl::ActiveStream::onIdleTimeout() { | |||
connection_manager_.stats_.named_.downstream_rq_idle_timeout_.inc(); | |||
// If headers have not been sent to the user, send a 408. | |||
if (response_headers_ != nullptr) { | |||
if (request_headers_ == nullptr || response_headers_ != nullptr) { |
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.
I think it's actually OK to send a reply if there are no request headers, we just can't do the gRPC check. I think this is what we want since you would still get a 408 request timeout response.
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.
Yes, I can do this, but we need to do a bit more plumbing, since sendLocalReply()
doesn't work out of the box today for responses sent before request headers (e.g. it needs them to detect upgrades).
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.
Oh, alright. Hmm. Probably not worth it. Add a comment maybe?
Signed-off-by: Harvey Tuch <[email protected]>
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.
Nice, thanks.
Signed-off-by: Harvey Tuch <[email protected]>
Cherry-pick envoyproxy/envoy#3970. Signed-off-by: Piotr Sikora <[email protected]>
Risk Level: Low
Testing: New unit test.
Signed-off-by: Harvey Tuch [email protected]