Skip to content

Commit 0b516f6

Browse files
authored
fix: Improve determinism for graceful shutdown (#11063)
### Description My theory is we have a race condition when `child.stop()` is called and child process exist quickly. We process the SIGINT in this `tokio::select`. Depending on which branch of the select the branch goes down, you could get the wrong behavior (KilledExternal instead of Interrupted). `biased;` gives us determinism for this situation. ### Testing Instructions CI <sub>CLOSES TURBO-4946</sub>
1 parent 7e12598 commit 0b516f6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

crates/turborepo-process/src/child.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ impl Child {
448448
shutdown_initiated: false,
449449
};
450450
tokio::select! {
451+
biased;
451452
command = command_rx.recv() => {
452453
manager.shutdown_initiated = true;
453454
manager.handle_child_command(command, &mut child, controller).await;

0 commit comments

Comments
 (0)