You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[S3] Cut off response bodies still streaming at the shutdown deadline #239
With #231, S3Server::shutdown_on cuts off requests still running when the grace period ends: their handlers are dropped and the client gets 503 ServiceUnavailable. A handler that has already returned its response is past that point, though. A GET whose body is still streaming keeps its connection open, and that connection's task holds an Arc<S3View> (and the store's sled lock) after run() returns.
spacectl serve-s3 isn't affected in practice, since the process exits right after run() and the runtime drops the task. Code that embeds S3Server and keeps its runtime running is: the store stays open until the client finishes or disconnects.
Where: cut_off_when_told and the wind-down after cut_off.cancel() in crates/protocol-s3/src/server.rs.
Proposed: at the cut-off, end streaming response bodies too, for example by wrapping the response body in one that stops at the cancellation token. Implement http_body::Body directly so the size hint and Content-Length are kept rather than switching to chunked encoding.
Done when:
a test in crates/protocol-s3/tests/shutdown_test.rs starts a large GET, reads part of it, signals with a short grace period, and finds the store can be reopened once run() returns;
Fixed in 5116505, PR #251. I put the cut-off on the connection rather than the response body. A client that stops reading leaves hyper waiting on the socket, so a wrapped body never gets polled. Each connection's IO now fails once a close token fires, and that wakes a write stuck on the client. run() fires it 1 s after the 503 cut-off. Bodies are untouched, so Content-Length stays. Test reopens the store while the client still holds the connection, and fails without the close. Changelog updated. Closes when the PR merges.
Activity
saworbit commentedon Nov 15, 2026
Fixed in 5116505, PR #251. I put the cut-off on the connection rather than the response body. A client that stops reading leaves hyper waiting on the socket, so a wrapped body never gets polled. Each connection's IO now fails once a close token fires, and that wakes a write stuck on the client. run() fires it 1 s after the 503 cut-off. Bodies are untouched, so Content-Length stays. Test reopens the store while the client still holds the connection, and fails without the close. Changelog updated. Closes when the PR merges.
Describe the soak's shutdown and lock changes in the docs (#254)