Allow accepting new connections during a graceful shutdown
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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時間
- マージ済み PR(30日)
- 14
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hyperium/hyper のほかの issue
-
C-feature
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
hyperium/hyper#2652 · リアクション 4 件 ·
メンテナーはふだん 1 日以内に返信
-
bug(ci): some warnings are not enforced by `features` step対応中かも @cratelyn が 3 日前に担当しました。 オープンA-tests C-bug
hyperium/hyper#4232 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Write a HIP for `Body::poll_progress()`対応中かも @cratelyn が 9 日前に担当しました。 オープン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 が 19 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
Allow connection pools to stop reusing an HTTP/2 connection before its keep-alive timeout対応中かも @jiahaoliang が 37 日前に担当しました。 オープンC-feature
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
hyperium/hyper#4186 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
EmbarkStudios/cargo-deny#910 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
tursodatabase/turso#10054 ·
メンテナーはふだん 1 日以内に返信
-
build: Update rust version対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdependencies
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
ibm-granite-community/granite-cli#229 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
orottier/web-audio-api-rs#658 ·