]> git.proxmox.com Git - proxmox-backup.git/commit - proxmox-backup-client/src/main.rs
fix #3359: fix blocking writes in async code during pxar create
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 23 Mar 2021 10:12:20 +0000 (11:12 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 24 Mar 2021 08:00:07 +0000 (09:00 +0100)
commitf1d76ecf6ca3d2262664b470fdbb06eb07c9cee7
tree51b2e2c422ff05906ede64475697f766919db262
parent074503f28852475d1b32e483f8a15b8f04927597
fix #3359: fix blocking writes in async code during pxar create

in commit `asyncify pxar create_archive`, we changed from a
separate thread for creating a pxar to using async code, but the
StdChannelWriter used for both pxar and catalog can block, which
may block the tokio runtime for single (and probably dual) core
environments

this patch adds a wrapper struct for any writer that implements
'std::io::Write' and wraps the write calls with 'block_in_place'
so that if called in a tokio runtime, it knows that this code
potentially blocks

Fixes: 6afb60abf557 ("asyncify pxar create_archive")
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/bin/proxmox-backup-client.rs
src/client/pxar_backup_stream.rs
src/tools.rs
src/tools/tokio_writer_adapter.rs [new file with mode: 0644]