Skip to content
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

Merged
merged 4 commits into from
Jul 28, 2018

Conversation

htuch
Copy link
Member

@htuch htuch commented Jul 27, 2018

Risk Level: Low
Testing: New unit test.

Signed-off-by: Harvey Tuch [email protected]

htuch added 2 commits July 27, 2018 10:58
…ved.

Risk Level: Low
Testing: New unit test.

Signed-off-by: Harvey Tuch <[email protected]>
Signed-off-by: Harvey Tuch <[email protected]>
@htuch
Copy link
Member Author

htuch commented Jul 27, 2018

@mattklein123

Copy link
Member

@mattklein123 mattklein123 left a 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) {
Copy link
Member

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.

Copy link
Member Author

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).

Copy link
Member

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?

mattklein123
mattklein123 previously approved these changes Jul 27, 2018
Copy link
Member

@mattklein123 mattklein123 left a 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]>
@mattklein123 mattklein123 merged commit 08fadcc into envoyproxy:master Jul 28, 2018
PiotrSikora added a commit to PiotrSikora/proxy that referenced this pull request Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants