fix(tvix/store): FuseDaemon unmount is blocking async runtime

The unmount method in FuseDaemon calls join on a bunch of threads and that is
a blocking call but it is called from an async context in the tvix-store
binary.

This change wraps the call to unmount in a spawn_blocking.

Change-Id: If89183b4a3f890874e75f5faf90cd24cb18da1e1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9489
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
This commit is contained in:
Brian Olsen 2023-09-29 18:34:41 +02:00 committed by Brian Olsen
parent f5a33ab15f
commit 5c2cad0ac4

View file

@ -350,7 +350,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
tokio::spawn(async move {
tokio::signal::ctrl_c().await.unwrap();
info!("interrupt received, unmounting…");
fuse_daemon.unmount()?;
tokio::task::spawn_blocking(move || fuse_daemon.unmount()).await??;
info!("unmount occured, terminating…");
Ok::<_, io::Error>(())
})