Allow accepting new connections during a graceful shutdown
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- rust
- 领域
- networking
调研方向
先阅读 hyper's proto/h1/dispatch.rs 和 proto/h1/conn.rs 中引用的 Rust 位置,然后阅读 hyper-util's server/conn/auto/mod.rs。跟踪取消和优雅关闭如何影响新连接和可升级连接;当提议的 flag 支持在初始关闭窗口期间接受连接,同时应用 GOAWAY 或 connection: close,并在最短截止时间之后停止接受连接时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
We want a very specific behavior for graceful shutdowns in our hyper-based proxy. We set two deadlines, min (typically 5-10s), and max (could be much longer). We want the following sequence during shutdown:
- t=0s: send GOAWAY on all HTTP2 connections and start responding with
connection: closeon all http1 requests. Continue to accept new connections, and handle them the same (GOAWAY/connection: close) them. - After
mindeadline: stop accepting new connections. Continue existing connections, with the sameGOAWAY/connection: close. - After
maxdeadline: shutdown everything.
The reason for the time when we accept new connections, but tell clients to go away, is that there is some time for the load balancers in front of the proxy (this could be something like AWS NLB, Kubernetes kube-proxy, etc) to de-register the proxy instance and stop sending traffic to it. So immediately dropping new connections results in downtime. However, during this time its nice to start to encourage clients to goaway, since its likely they will select another proxy instance (either because the fronting LB already de-registered the old instance (the min deadline is intended to be the worst case, so usually its much faster), or because of random chance it selects a different one).
Today, the best we can do is wait until after min deadline and stop accepting new connections and start GOAWAY/connection: close at the same time.
Describe the solution you'd like
A new flag on hyper_util::server::conn::auto, and on hyper::server::conn::http1 to enable the "different graceful shutdown mode" (naming TBD!). This would change:
- https://github.com/hyperium/hyper/blob/f9f8f44058745d23fa52abf51b96b61ee7665642/src/proto/h1/dispatch.rs#L97 - skip the close() call
- https://github.com/hyperium/hyper/blob/f9f8f44058745d23fa52abf51b96b61ee7665642/src/proto/h1/conn.rs#L878 - skip the close() call
- https://github.com/hyperium/hyper-util/blob/66afc93debef02548c86e8454e6bc01cf4fca280/src/server/conn/auto/mod.rs#L341 - do no error here
- https://github.com/hyperium/hyper-util/blob/66afc93debef02548c86e8454e6bc01cf4fca280/src/server/conn/auto/mod.rs#L525-L531 -- if
cancelled, then callgraceful_shutdown()on the newly served connections (and do the same for UpgradeableConnection)
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
If these changes are acceptable I would be happy to contribute both parts of the change
- 主要语言
- Rust
- 星标
- 16.4k
- 派生
- 1.8k
- 平均合并
- 2 天 9 小时
- 30 天内合并 PR
- 14
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
hyperium/hyper 的其他 Issue
-
C-feature
难度 1/5 1 小时以内 新手友好度 65/100
hyperium/hyper#2652 · 4 个 reaction ·
维护者通常 1 天内回复
-
bug(ci): some warnings are not enforced by `features` step可能已有人在做 @cratelyn 于 1 天前认领。 未关闭A-tests C-bug
hyperium/hyper#4232 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Write a HIP for `Body::poll_progress()`可能已有人在做 @cratelyn 于 7 天前认领。 未关闭A-body B-rfc C-feature
hyperium/hyper#4228 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Upgraded HTTP/2 CONNECT streams cannot be reset, so a failed tunnel looks like a clean close可能已有人在做 @jeremyjpj0916 于 16 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 1 天内回复
-
Allow connection pools to stop reusing an HTTP/2 connection before its keep-alive timeout可能已有人在做 @jiahaoliang 于 34 天前认领。 未关闭C-feature
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
Custom hosts written as trailing-dot FQDNs (`host.local.`) aren't detected as local backends可能已有人在做 @roboomp 今天认领。 未关闭bug prio:p2 providers triaged
难度 2/5 1-3 小时 新手友好度 82/100
can1357/oh-my-pi#15798 · 3 条评论 ·
维护者通常 1 天内回复
-
requires-triage
难度 2/5 1-3 小时 新手友好度 68/100
apache/datafusion-comet#7001 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
-
Add a Storybook section to CONTRIBUTING.md可能已有人在做 @ChanakyaG2004 今天认领。 未关闭documentation good first issue
难度 2/5 1-3 小时 新手友好度 82/100
FlowwStar/FlowStar#995 · 2 条评论 ·
维护者通常 1 天内回复