Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
docs: clarify which response data survives shutdown
  • Loading branch information
dougct committed Nov 18, 2026
commit 45f33ba1d01ec82f22ca4607b825cd600b2cf289
7 changes: 4 additions & 3 deletions docs/src/internals/proxy-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,10 @@ When the runtime shuts down, it pauses its sandboxes. A proxied HTTP request
that is still open then waits for an answer from a sandbox that sends none.
Once that sandbox shutdown has finished or failed, the runtime ends those
requests. A request still waiting for response headers gets `502 Bad Gateway`.
A response body first forwards frames that are already available, so a buffered
command acknowledgment can finish. If the body then needs another frame, it
ends with an error and the client sees a broken connection.
A response body first forwards any data Hyper, the HTTP library, can return
immediately. A complete response already available this way can finish normally.
If Hyper would need to wait, the body ends with an error. Bytes still waiting
in the socket or being processed by Hyper may be lost.

The server still waits for other HTTP connections to drain. A download whose
client has stopped reading can remain open because Hyper stops polling its
Expand Down
2 changes: 1 addition & 1 deletion src/api/impls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl ApiImpl {
}

/// Signals the runtime HTTP proxy to end requests that need more sandbox data.
/// Response bodies still forward any data already received.
/// Response bodies still forward data Hyper can return immediately.
///
/// Call this after sandbox shutdown. Paused or stopped sandboxes cannot
/// answer these requests, so waiting for them would hold up shutdown.
Expand Down
6 changes: 3 additions & 3 deletions src/api/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,9 +1124,9 @@ fn map_upstream_response(
Response::from_parts(parts, Body::new(body))
}

/// Forwards response data already received, including during shutdown.
/// After cancellation, returns an error if more data would require waiting.
/// A paused sandbox cannot provide that data.
/// Forwards response data Hyper can return immediately, including during shutdown.
/// After cancellation, returns an error if Hyper would need to wait for more data.
/// Bytes still in the socket or being processed by Hyper may be lost.
struct UpstreamBody {
body: Incoming,
requests_ended: Pin<Box<dyn Future<Output = ()> + Send>>,
Expand Down
Loading