Avoid null metric recorder remoteAddress parameters#2755
Merged
pderop merged 6 commits intoreactor:1.0.xfrom May 3, 2023
Merged
Avoid null metric recorder remoteAddress parameters#2755pderop merged 6 commits intoreactor:1.0.xfrom
remoteAddress parameters#2755pderop merged 6 commits intoreactor:1.0.xfrom
Conversation
Contributor
Author
|
@violetagg , please wait a bit before checking, I may have to update the test before. |
Contributor
Author
|
it is ok. |
Contributor
Author
|
forced push after a rebase on top of 1.0.x branch, in order to pick up #2761 |
Contributor
Author
|
rebased on top of latest 1.0.x branch, in order to pick up #2787 and align to latest codebase version. |
Contributor
Author
|
squashed all commits and rebased on top of latest 1.0.x branch. |
violetagg
reviewed
May 3, 2023
reactor-netty-http/src/main/java/reactor/netty/http/server/HttpServerOperations.java
Outdated
Show resolved
Hide resolved
… Now, the testServerConnectionsRecorderBadUriUDS is run only if UDS is available.
violetagg
approved these changes
May 3, 2023
Contributor
Author
|
@violetagg , thanks for the review !! |
pderop
added a commit
that referenced
this pull request
May 3, 2023
remoteAddress parameters
violetagg
added a commit
that referenced
this pull request
Apr 29, 2024
This is a change additional to the change made with #2755
violetagg
added a commit
that referenced
this pull request
Apr 29, 2024
This is a change additional to the change made with #2755
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
When a reactor-netty http server receives a request with an invalid request URI which can't be parsed, any registered metric recorders are invoked with some null
remoteAddressparameters. Basically, when the URL can’t be parsed, a 400 bad request is sent using HttpServerOperations.sendDecodingFailures which is using a FailedHttpServerRequest. And the constructor of FailedHttpServerRequest calls super(...) with null as the fifth parameter which is the connectionInfo.That’s why AbstractHttpServerMetricsHandler.recordWrite passes a null remoteAddress parameter because ops.remoteAddress() returns null (connectionInfo is null).
Modification:
The ConnectionInfo object is now used when sending a decoding error. Now, if the ConnectionInfo could not be created in some rare conditions like when the Host or Forwarded/X-Forwarded-For headers are malformed, then we fallback on established connection info.
Fixes #2748