From 372a65aa15d33a5346ff5f7fc9928d115f9218d7 Mon Sep 17 00:00:00 2001 From: Nahor Date: Sun, 19 Oct 2025 12:11:59 -0700 Subject: [PATCH] Temporary workaround for #11933 on Cygwin Without the sleep, `flock` sometimes returns an error 14 "bad addr". This puts the application into a deadlock. --- src/fs.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fs.rs b/src/fs.rs index caa94113c..53d08628a 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -151,6 +151,10 @@ pub fn new(locking_mode: LockingMode, file_path: &wstr) -> std::io::Result return Err(err); } } + #[cfg(cygwin)] + // Prevents error 14 "Bad Addr" on Windows (#11933). If the error happens + // the process appears deadlocked + std::thread::sleep(std::time::Duration::from_nanos(1)); // Open the data file let data_file = wopen_cloexec(file_path, locking_mode.file_flags(), LOCKED_FILE_MODE)?;