Skip to content

Avoid null metric recorder remoteAddress parameters#2755

Merged
pderop merged 6 commits intoreactor:1.0.xfrom
pderop:1.0.x-issue-2748
May 3, 2023
Merged

Avoid null metric recorder remoteAddress parameters#2755
pderop merged 6 commits intoreactor:1.0.xfrom
pderop:1.0.x-issue-2748

Conversation

@pderop
Copy link
Copy Markdown
Contributor

@pderop pderop commented Mar 30, 2023

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

@pderop pderop added the type/bug A general bug label Mar 30, 2023
@pderop pderop added this to the 1.0.31 milestone Mar 30, 2023
@pderop pderop self-assigned this Mar 30, 2023
@pderop
Copy link
Copy Markdown
Contributor Author

pderop commented Mar 30, 2023

@violetagg , please wait a bit before checking, I may have to update the test before.
thanks.

@pderop
Copy link
Copy Markdown
Contributor Author

pderop commented Mar 30, 2023

it is ok.
I'm now waiting for the CI build results.

@pderop pderop changed the title Avoid null metric recorders remoteAddress parameters Avoid null metric recorder remoteAddress parameters Mar 30, 2023
@pderop pderop requested a review from violetagg March 30, 2023 10:13
@pderop pderop marked this pull request as draft March 30, 2023 12:07
@pderop pderop marked this pull request as ready for review March 31, 2023 12:44
@violetagg violetagg modified the milestones: 1.0.31, 1.0.32 Apr 7, 2023
@pderop pderop force-pushed the 1.0.x-issue-2748 branch from 337f23b to 8bce92b Compare April 7, 2023 13:54
@pderop
Copy link
Copy Markdown
Contributor Author

pderop commented Apr 7, 2023

forced push after a rebase on top of 1.0.x branch, in order to pick up #2761

@pderop pderop marked this pull request as draft April 20, 2023 16:02
@pderop pderop force-pushed the 1.0.x-issue-2748 branch from 8bce92b to d0cffbf Compare May 2, 2023 06:59
@pderop
Copy link
Copy Markdown
Contributor Author

pderop commented May 2, 2023

rebased on top of latest 1.0.x branch, in order to pick up #2787 and align to latest codebase version.

@pderop pderop force-pushed the 1.0.x-issue-2748 branch from ce566d3 to 43348c3 Compare May 2, 2023 13:20
@pderop
Copy link
Copy Markdown
Contributor Author

pderop commented May 2, 2023

squashed all commits and rebased on top of latest 1.0.x branch.

@pderop pderop marked this pull request as ready for review May 2, 2023 16:51
@pderop pderop merged commit 7c30195 into reactor:1.0.x May 3, 2023
pderop added a commit that referenced this pull request May 3, 2023
@pderop
Copy link
Copy Markdown
Contributor Author

pderop commented May 3, 2023

@violetagg , thanks for the review !!

pderop added a commit that referenced this pull request May 3, 2023
@violetagg violetagg changed the title Avoid null metric recorder remoteAddress parameters Avoid null metric recorder remoteAddress parameters May 4, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants