chore(engine): add force shutdown timeout#3999
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR Review: Add Force Shutdown TimeoutSummaryThis PR adds a configurable ✅ Strengths
🔍 Issues & Suggestions1. Potential race condition with force exit task (engine/packages/service-manager/src/lib.rs:342-349)The spawned force exit task is not cancelled if graceful shutdown completes successfully. This means:
Recommendation: Store the task handle and abort it when graceful shutdown completes: let force_shutdown_handle = tokio::spawn(async move {
tracing::info!(?force_shutdown_duration, "force shutdown timer started");
tokio::time::sleep(force_shutdown_duration).await;
tracing::warn!("force shutdown timeout reached, exiting process, this indicates a bug");
std::process::exit(1);
});
// ... later, after graceful shutdown completes ...
force_shutdown_handle.abort();2. Exit code should be more distinctiveUsing 3. Missing structured logging fieldThe warning message at line 347 could benefit from including which services/tasks were still running when the timeout fired. This would help debug why shutdown hung. 4. No test coverageThere are no tests validating:
Consider adding unit tests for the validation logic in 5. Documentation comment style inconsistency (engine/packages/config/src/config/runtime.rs:36)The doc comment says "Returns the force shutdown duration" but doesn't mention it also computes the default. Consider: /// Returns the force shutdown duration.
///
/// Defaults to guard_shutdown_duration + 30 seconds if not explicitly configured.
pub fn force_shutdown_duration(&self) -> Duration {🔒 Security ConsiderationsNo security concerns identified. The use of ⚡ Performance Considerations
📝 Style & Convention Notes
🎯 RecommendationApprove with suggested changes. The PR is functionally sound but would benefit from:
The core functionality is solid and addresses a real operational concern. The validation logic is well-implemented. |
More templates
@rivetkit/cloudflare-workers
@rivetkit/db
@rivetkit/framework-base
@rivetkit/next-js
@rivetkit/react
rivetkit
@rivetkit/sql-loader
@rivetkit/virtual-websocket
@rivetkit/engine-runner
@rivetkit/engine-runner-protocol
commit: |
09b5c56 to
52751a1
Compare
8ada9bb to
45f73be
Compare
Merge activity
|

No description provided.