Skip to content

http: fix segfault when idle timer fires before request headers received.#3970

Merged
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
htuch:fix-hcm-segfault
Jul 28, 2018
Merged

http: fix segfault when idle timer fires before request headers received.#3970
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
htuch:fix-hcm-segfault

Conversation

@htuch
Copy link
Copy Markdown
Member

@htuch htuch commented Jul 27, 2018

Risk Level: Low
Testing: New unit test.

Signed-off-by: Harvey Tuch htuch@google.com

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

Risk Level: Low
Testing: New unit test.

Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
@htuch
Copy link
Copy Markdown
Member Author

htuch commented Jul 27, 2018

@mattklein123

Copy link
Copy Markdown
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.

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

Signed-off-by: Harvey Tuch <htuch@google.com>
mattklein123
mattklein123 previously approved these changes Jul 27, 2018
Copy link
Copy Markdown
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 <htuch@google.com>
@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
Cherry-pick envoyproxy/envoy#3970.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
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