fix(deps): pin hyper to flush-before-shutdown fix for large-GET unexpected EOF (#4797)

* fix(deps): pin hyper to flush-before-shutdown fix for large-GET unexpected EOF

hyper <= 1.10.1 can call poll_shutdown() on an HTTP/1 socket while response
bytes are still buffered (a prior poll_flush() returned Poll::Pending and the
result was discarded), so a backpressured/slow-reading peer receives a graceful
FIN before the full Content-Length body is flushed. Standard S3 clients
(minio-go/warp) report this as sporadic `unexpected EOF` on large-object GET
under load (rustfs/backlog#1232). This is the transport-layer bug from
Cloudflare's "hyper-bug" writeup — distinct from the EC-reconstruct-desync EOF
already fixed via lockstep decode; here the app layer delivers the full body and
truncation is purely hyper->socket.

Fixed upstream in hyperium/hyper#4018 (commit 72046cc7, "fix(http1): flush
buffered data before shutdown"), which is not in any crates.io release yet as of
hyper 1.10.1. Pin hyper via [patch.crates-io] to git rev ccc1e850 (a descendant
of the fix that still declares version 1.10.1).

Use [patch.crates-io], not a git+rev on the workspace `hyper` dependency: the
server connection is driven by the transitive hyper-util (conn::auto /
GracefulShutdown), and a git source would not unify with the crates.io hyper
hyper-util resolves, leaving two hyper copies with the server path still on the
buggy one. The patch rewrites the crates.io source globally, so the lockfile
holds a single git-sourced hyper.

Add rustfs/tests/hyper_h1_shutdown_flush_regression.rs, a deterministic guard
(mirrors hyper's own h1_shutdown_while_buffered) that fails if the pin is dropped
or hyper is downgraded below the fix. Its load-bearing assertion is a
synchronously-set flag, so a slow runner can only under-detect, never false-red.

Closes rustfs/backlog#1232.

* build(deny): allow the hyperium/hyper git source for the flush-before-shutdown pin

cargo-deny's [sources] check denies unknown git sources. The hyper
[patch.crates-io] pin added for rustfs/backlog#1232 uses a github.com/hyperium
git source, so add it to allow-git with an owner/review note and a removal
condition (drop once a released hyper > 1.10.1 carries commit 72046cc7).
This commit is contained in:
Zhengchao An
2026-07-13 23:36:38 +08:00
committed by GitHub
parent 0ac7f0d0cf
commit 0f83a27f6a
4 changed files with 181 additions and 2 deletions
+6
View File
@@ -40,6 +40,12 @@ allow-git = [
# Pinned to a specific commit in workspace Cargo.toml.
# "https://github.com/rustfs/s3s",
"https://github.com/apache/datafusion.git",
# hyper pinned (via [patch.crates-io]) to a rev carrying the HTTP/1
# flush-before-shutdown fix (hyperium/hyper#4018, commit 72046cc7) that is
# not yet in a crates.io release. Fixes sporadic large-GET `unexpected EOF`
# (rustfs/backlog#1232). Remove once a released hyper > 1.10.1 contains it.
# owner: rustfs-maintainers review: 2026-07
"https://github.com/hyperium/hyper.git",
]
[bans]