From 75f9f40922f9c5380336b987519d9d46d5b6db03 Mon Sep 17 00:00:00 2001 From: Stefan Reiter Date: Thu, 6 May 2021 17:26:20 +0200 Subject: [PATCH] file-restore-daemon: work around tokio DuplexStream bug See this PR for more info: https://github.com/tokio-rs/tokio/pull/3756 As a workaround use a pair of connected unix sockets - this obviously incurs some overhead, albeit not measureable on my machine. Once tokio includes the fix we can go back to a DuplexStream for performance and simplicity. Signed-off-by: Stefan Reiter --- src/bin/proxmox_restore_daemon/api.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bin/proxmox_restore_daemon/api.rs b/src/bin/proxmox_restore_daemon/api.rs index f1d601ce..5aeb69f3 100644 --- a/src/bin/proxmox_restore_daemon/api.rs +++ b/src/bin/proxmox_restore_daemon/api.rs @@ -275,7 +275,11 @@ fn extract( bail!("file or directory {:?} does not exist", path); } - let (mut writer, reader) = tokio::io::duplex(1024 * 64); + // FIXME: DuplexStream is currently broken and doesn't wake pending writers on close, i.e. + // this doesn't drop the WatchdogInhibitor if we encounter an error (client aborts, etc...) + // see: https://github.com/tokio-rs/tokio/pull/3756 + // let (mut writer, reader) = tokio::io::duplex(1024 * 64); + let (mut writer, reader) = tokio::net::UnixStream::pair()?; if pxar { tokio::spawn(async move {