fix(runtime): bound graceful shutdown drain - #10705
Conversation
Signed-off-by: Michael Feil <63565275+michaelfeil@users.noreply.github.com>
WalkthroughAdds a configurable graceful-shutdown timeout to the Dynamo runtime via a new ChangesGraceful Shutdown Timeout
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
cdfa97e to
83cb4df
Compare
Signed-off-by: Michael Feil <63565275+michaelfeil@users.noreply.github.com>
83cb4df to
b3f5f4a
Compare
|
@CodeRabbit review |
✅ Action performedReview finished.
|
|
/ok to test 3d90898 |
Signed-off-by: Michael Feil <63565275+michaelfeil@users.noreply.github.com>
|
all comments addressed, the signoff should be correct without revealing my personal email. All commits were written/authored by me. |
|
/ok to test 95f1634 |
|
should be all addressed, go to merge |
On endpoint teardown the graceful-shutdown path waited on
`while inflight > 0 { notify.notified().await }` with no timeout. A single
stuck inflight request (e.g. a request whose engine can no longer make
progress and cannot be aborted) keeps inflight > 0, so the drain wedges, the
serve future never returns, and `Runtime::shutdown()` is never reached — the
worker zombies (Running, /health green, unable to serve).
Extract the drain into `drain_inflight`, bounded by the existing #10705
`graceful_shutdown_timeout()` (made pub(crate); no new env/const), returning
the count still inflight when the bound fires. Tested with paused time: the
bounded wait returns instead of hanging when a request never completes, and
still drains cleanly to zero when it does.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: nnshah1 <neelays@nvidia.com>
On endpoint teardown the graceful-shutdown path waited on
`while inflight > 0 { notify.notified().await }` with no timeout, on BOTH
request planes (NATS `PushEndpoint` and the default TCP `SharedTcpServer`). A
single stuck inflight request (e.g. one whose engine can no longer make
progress and cannot be aborted) keeps inflight > 0, so the drain wedges, the
serve future never returns, and `Runtime::shutdown()` is never reached — the
worker zombies (Running, /health green, unable to serve).
Add a shared `drain_inflight` helper in the ingress module, bounded by the
existing #10705 `graceful_shutdown_timeout()` (made pub(crate); no new
env/const), and call it from both `PushEndpoint::start` and
`SharedTcpServer::unregister_endpoint`. Tested with paused time: the bounded
wait returns instead of hanging when a request never completes, and still
drains cleanly to zero when it does.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: nnshah1 <neelays@nvidia.com>
On endpoint teardown the graceful-shutdown path waited on
`while inflight > 0 { notify.notified().await }` with no timeout, on BOTH
request planes (NATS `PushEndpoint` and the default TCP `SharedTcpServer`). A
single stuck inflight request (e.g. one whose engine can no longer make
progress and cannot be aborted) keeps inflight > 0, so the drain wedges, the
serve future never returns, and `Runtime::shutdown()` is never reached — the
worker zombies (Running, /health green, unable to serve).
Add a shared `drain_inflight` helper in the ingress module, bounded by the
existing #10705 `graceful_shutdown_timeout()` (made pub(crate); no new
env/const), and call it from both `PushEndpoint::start` and
`SharedTcpServer::unregister_endpoint`. Tested with paused time: the bounded
wait returns instead of hanging when a request never completes, and still
drains cleanly to zero when it does.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: nnshah1 <neelays@nvidia.com>
On endpoint teardown the graceful-shutdown path waited on
`while inflight > 0 { notify.notified().await }` with no timeout, on BOTH
request planes (NATS `PushEndpoint` and the default TCP `SharedTcpServer`). A
single stuck inflight request (e.g. one whose engine can no longer make
progress and cannot be aborted) keeps inflight > 0, so the drain wedges, the
serve future never returns, and `Runtime::shutdown()` is never reached — the
worker zombies (Running, /health green, unable to serve).
Add a shared `drain_inflight` helper in the ingress module, bounded by the
existing #10705 `graceful_shutdown_timeout()` (made pub(crate); no new
env/const), and call it from both `PushEndpoint::start` and
`SharedTcpServer::unregister_endpoint`. Tested with paused time: the bounded
wait returns instead of hanging when a request never completes, and still
drains cleanly to zero when it does.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: nnshah1 <neelays@nvidia.com>
Bound
Runtime::shutdown()Phase 2 graceful endpoint draining withDYN_RUNTIME_GRACEFUL_SHUTDOWN_TIMEOUT_SECS.Closes: #10704
Signed-off-by: Michael Feil 63565275+michaelfeil@users.noreply.github.com
Summary by CodeRabbit
Documentation
New Features
Bug Fixes