fix(rivetkit-core): don't install tokio::signal::ctrl_c() handler inside serve_with_config#4731
Conversation
62f3a06 to
d26d955
Compare
4d57453 to
397fe1f
Compare
397fe1f to
8a8be67
Compare
d26d955 to
1c8fb57
Compare
Code Review: fix(rivetkit-core): don't install ctrl_c() handler inside serve_with_configOverviewThis PR fixes a real and subtle bug: calling The fix is correct and necessary. A few areas worth considering before merging: Issues1. Envoy handle is dropped without sending a shutdown signal The old code explicitly called If the NAPI caller is responsible for graceful shutdown, there should be a documented path for it — either a method on a returned handle, or a 2. Engine process gets SIGKILL'd instead of SIGTERM'd
For the embedded-in-NAPI case this may be acceptable (the engine process is local and its state is durable), but the change in behavior is worth calling out explicitly. 3. Log tasks are detached on drop
4. Underscore-prefixed identifiers conventionally mean "intentionally unused." Here, // Keep the envoy handle alive for the duration of serve; drop drives shutdown.
let _handle = start_envoy(...).await;Positive Notes
MinorThe |
Code Review: fix(rivetkit-core): remove tokio::signal::ctrl_c() from serve_with_configOverviewThis PR removes the The fix is directionally correct. There are a few issues worth addressing before merging. Critical: Envoy client still installs a ctrl_c handler
// Start signal handler
let handle2 = handle.clone();
tokio::spawn(async move {
let _ = tokio::signal::ctrl_c().await;
handle2.shutdown(false);
});This calls Moderate: Graceful envoy shutdown path is removedThe old code called Consider adding a Minor: Engine process teardown regresses from SIGTERM to SIGKILLOld path: New path: For a local dev engine this is probably acceptable, but it is a silent behavioral change. A What Is Done Well
SummaryThe fix is incomplete: the ctrl_c handler in |
1c8fb57 to
7377471
Compare
8a8be67 to
026a6ce
Compare
7377471 to
6b8454a
Compare
026a6ce to
836ab72
Compare
…ide serve_with_config
836ab72 to
82a4042
Compare
6b8454a to
4026613
Compare

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: