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

Do not wait for request data after decode failure #6941

Merged
merged 1 commit into from
Feb 21, 2022

Conversation

yawkat
Copy link
Member

@yawkat yawkat commented Feb 21, 2022

When there is a failure during decoding of header values, netty will consume the entire input and not forward it. However, if we expect content data e.g. due to a Content-Length header, RoutingInBoundHandler would wait indefinitely for that data before sending the error response.

This patch changes HttpStreamsServerHandler to treat a decode failure request as if it had no body. This way a StreamedHttpRequest is never created. I also considered just bypassing the StreamedHttpRequest wait in RoutingInBoundHandler, but that risks unexpected behavior from the StreamedHttpRequest publisher never finishing (see #6935), so I tried to avoid StreamedHttpRequest entirely.

There is also a change to force the connection to close, to prevent possible downstream errors from connection reuse.

Fixes #6925

When there is a failure during decoding of header values, netty will consume the entire input and not forward it. However, if we expect content data e.g. due to a Content-Length header, RoutingInBoundHandler would wait indefinitely for that data before sending the error response.

This patch changes HttpStreamsServerHandler to treat a decode failure request as if it had no body. This way a StreamedHttpRequest is never created. I also considered just bypassing the StreamedHttpRequest wait in RoutingInBoundHandler, but that risks unexpected behavior from the StreamedHttpRequest publisher never finishing (see #6935), so I tried to avoid StreamedHttpRequest entirely.

There is also a change to force the connection to close, to prevent possible downstream errors from connection reuse.

Fixes #6925
@yawkat yawkat added the type: bug Something isn't working label Feb 21, 2022
@jameskleeh jameskleeh merged commit 98ef403 into 3.3.x Feb 21, 2022
@jameskleeh jameskleeh deleted the long-header-timeout branch February 21, 2022 19:33
yawkat added a commit that referenced this pull request Mar 21, 2022
sdelamo pushed a commit that referenced this pull request Mar 24, 2022
* Add netty buffer leak detection for all tests in http-server-netty

* fix HttpPipeliningSpec leak

* fix leak for cancelled FormDataHttpContentProcessor

* touch content in NettyHttpRequest to make debugging easier

* stop forwarding messages in HandlerPublisher immediately, because downstream CompletionAwareSubscriber might discard and leak them

* Don't use ByteBuffer in TextStreamCodec because we can't release it in http-server
* Better buffer ownership for form data / routing handlers

* log discarded errors in CompletionAwareSubscriber

* don't add more data to already-destroyed http requests

* leak detection for NettyCompletedFileUpload

* discard populated parameters when route match fails

* discard uploads in test

* fix leak introduced by #6941

* Add getInitialHint support to BufferLeakDetection

Co-authored-by: jameskleeh <james.kleeh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
3 participants