fix(health): remove TCP half-close that breaks Docker health check#2
Merged
fix(health): remove TCP half-close that breaks Docker health check#2
Conversation
The health check client called `writer.shutdown()` after sending the HTTP request, which sends a TCP FIN to hyper. Hyper's connection handler interprets the FIN as a premature close and aborts before sending the response, producing "connection closed before message completed" errors every 2 seconds and marking the container unhealthy. Remove the stream split and half-close — the GET request is self-framing and the `Connection: close` header tells hyper to close after responding, giving `read_to_string` its EOF naturally. Also downgrade the connection-error log from `error!` to `warn!` since client-side resets are expected in normal operation. Closes #1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add integration tests that simulate the Docker HEALTHCHECK's raw TCP health check pattern, verifying the server responds correctly without TCP half-close. Also add a CI step to the s3-test workflow that runs the built-in --health-check flag and checks server logs for connection errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
writer.shutdown()after sending the HTTP request, which sends a TCP FIN. Hyper interprets the FIN as the connection closing prematurely and aborts before sending the response — producing"connection closed before message completed"errors every 2s and marking the container unhealthy.Connection: closeheader tells hyper to close after responding, givingread_to_stringits EOF naturally.error!towarn!since client resets are normal.Closes #1
Test plan
cargo build/cargo test/cargo clippypassdocker compose upwith the image rebuilt from this branch and verify container shows(healthy)"connection closed before message completed"errors in logs🤖 Generated with Claude Code