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

fix: default clientError replies on reused connection (#4101) #4133

Merged
merged 1 commit into from Jul 12, 2022

Conversation

katreniak
Copy link
Contributor

@katreniak katreniak commented Jul 12, 2022

When fastify server receives request with invalid url
in a reused connection, it closes the connection
instead of 400 Bad Request reply.

The closed connection is then propagated by load balancer (ALB)
as 502 error. This turns client errors into closely monitored
server errors.

socket.bytesWritten is never going to be 0 on reused connection.

Checklist

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

fastify.js Outdated Show resolved Hide resolved
@katreniak katreniak force-pushed the brko/bad-request-in-reused-connection branch 2 times, most recently from 0ee66a1 to 899442b Compare July 12, 2022 14:31
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

When fastify server receives request with invalid url
in a reused connection, it closes the connection
instead of 400 Bad Request reply.

The closed connection is then propagated by load balancer (ALB)
as 502 error. This turns client errors into closely monitored
server errors.

`socket.bytesWritten` is never going to be 0 on reused connection.
@katreniak katreniak force-pushed the brko/bad-request-in-reused-connection branch from 899442b to 588f219 Compare July 12, 2022 14:44
@Eomm Eomm added the bugfix Issue or PR that should land as semver patch label Jul 12, 2022
@Eomm Eomm merged commit fe889ea into fastify:main Jul 12, 2022
@katreniak katreniak deleted the brko/bad-request-in-reused-connection branch July 12, 2022 16:26
@salzhrani
Copy link

@mcollina Can this fix be back ported to v3 please?

@jsumners
Copy link
Member

We maintain security related fixes on prior major releases according to https://github.com/fastify/fastify/blob/cd20280bed489fe4cdae91b447088c31dcb87916/docs/Reference/LTS.md

If you'd like to take on the work and submit a PR, we will certainly consider it.

@salzhrani
Copy link

@jsumners PR is ready for your kind review
#4217
I had to bump the version in fastify.js to match the one in package.json since it cause a test to fail

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bugfix Issue or PR that should land as semver patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants