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

Use status code 499 for requests where the client closed the connection #77

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

Alexander-N
Copy link

@Alexander-N Alexander-N commented Oct 18, 2023

In the metrics, we were seeing a lot of requests with status code 500, which we did not see in the logs. It turned out that when a client closed the connection before a response was returned, it was reported as 500.

With this change, if the client closes the connection before a response was returned, 499 is used as status code (same code as nginx uses).

I think it's not possible to handle the http.disconnect event in receive since I think there is not guarantee that it will get called.

Unfortunately, I can't think of a way to test this, as the TestClient does not send http.disconnect but it is working for us in production.

If the client closes the connection before a response was returned, 499
is used as status code as in nginx.
@stephenhillier
Copy link
Owner

Hi @Alexander-N , thanks for the contribution. I was initially concerned about changing the existing behavior, but after thinking about it, it does make sense to stop counting client disconnects as 500 errors.

@stephenhillier stephenhillier merged commit 6863016 into stephenhillier:master Oct 21, 2023
7 checks passed
@Alexander-N
Copy link
Author

Great, do you have a rough timeline for the next release?

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