From f499d2e031c100b6e1af53c8d77c045667ec1909 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 3 Sep 2023 17:39:44 +0300 Subject: feat(tvix/store): fix ctrl-c handling on mount command This enables the tokio `signal` feature, and registers a ctrl_c signal handler, which will use the unmount handle to unmount in case a ctrl-c signal is received. This avoids having disconnected mountpoints when Ctrl-C'ing a `tvix-store mount` invocation. In case the filesystem is unmounted externally (via `umount /path/to/ mountpoint`), the future is waiting for the signal is never resolved and the task is stopped. Change-Id: I149f705a6cb50188177f2a6c6a5fcd77218e2a3f Reviewed-on: https://cl.tvl.fyi/c/depot/+/9218 Reviewed-by: tazjin Autosubmit: flokli Tested-by: BuildkiteCI --- tvix/Cargo.nix | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'tvix/Cargo.nix') diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix index 750dee2bb2..4089008aaa 100644 --- a/tvix/Cargo.nix +++ b/tvix/Cargo.nix @@ -6092,6 +6092,23 @@ rec { "loom" = [ "dep:loom" ]; }; }; + "signal-hook-registry" = rec { + crateName = "signal-hook-registry"; + version = "1.4.1"; + edition = "2015"; + sha256 = "18crkkw5k82bvcx088xlf5g4n3772m24qhzgfan80nda7d3rn8nq"; + authors = [ + "Michal 'vorner' Vaner " + "Masaki Hara " + ]; + dependencies = [ + { + name = "libc"; + packageId = "libc"; + } + ]; + + }; "slab" = rec { crateName = "slab"; version = "0.4.8"; @@ -6924,6 +6941,12 @@ rec { name = "pin-project-lite"; packageId = "pin-project-lite"; } + { + name = "signal-hook-registry"; + packageId = "signal-hook-registry"; + optional = true; + target = { target, features }: (target."unix" or false); + } { name = "socket2"; packageId = "socket2"; @@ -6987,7 +7010,7 @@ rec { "tracing" = [ "dep:tracing" ]; "windows-sys" = [ "dep:windows-sys" ]; }; - resolvedDefaultFeatures = [ "bytes" "default" "io-std" "io-util" "libc" "macros" "mio" "net" "num_cpus" "rt" "rt-multi-thread" "socket2" "sync" "time" "tokio-macros" "windows-sys" ]; + resolvedDefaultFeatures = [ "bytes" "default" "io-std" "io-util" "libc" "macros" "mio" "net" "num_cpus" "rt" "rt-multi-thread" "signal" "signal-hook-registry" "socket2" "sync" "time" "tokio-macros" "windows-sys" ]; }; "tokio-io-timeout" = rec { crateName = "tokio-io-timeout"; @@ -8363,7 +8386,7 @@ rec { { name = "tokio"; packageId = "tokio"; - features = [ "rt-multi-thread" "net" ]; + features = [ "net" "rt-multi-thread" "signal" ]; } { name = "tokio-stream"; -- cgit 1.4.1