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

Twirp server emits 200 status code when it fails to write the response #398

Open
Aerendel opened this issue Aug 28, 2024 · 0 comments
Open

Comments

@Aerendel
Copy link

While troubleshooting some errors, I noticed that in rare cases where twirp fails to write out all the response bytes to the response (for example due to some i/o timeout), the response status code is still set to 200. However, the error is caught and sent to error hooks which leads to weird situations where one might see a twirp error logged, yet a success status code. From a client perspective, I haven't been able to test this but I imagine you would get an HTTP 200 with an incomplete / impossible to parse response.

The code in question is here. Line 1357 sets the 200 status, and after on line 1363 write errors are handled but the status code is unchanged.

There might be a good reason for this, but I think this should be served as 5xx status?

Happy to help work on a pull request if this is a valid bug that you think should be fixed, or please let me know if this behavior is by design.

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

No branches or pull requests

1 participant