nix-rust / nix

Rust friendly bindings to *nix APIs
MIT License
2.63k stars 661 forks source link

Debug `mount::test_mount::test_mount_bind` on Linux #2369

Closed SteveLauC closed 5 months ago

SteveLauC commented 5 months ago
failures:

---- mount::test_mount::test_mount_bind stdout ----
thread 'mount::test_mount::test_mount_bind' panicked at 'umount failed: EBUSY: Device or resource busy', test/mount/test_mount.rs:172:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

full log: https://github.com/nix-rust/nix/actions/runs/8673165857/job/23784229944?pr=2367

SteveLauC commented 5 months ago

It happens again, on Linux/Amd64/Musl:

https://github.com/nix-rust/nix/actions/runs/8673600090/job/23785096039?pr=2371

TheJonny commented 5 months ago

Shouldn't we take the FORK_MTX? forking a process is duplicating all file descriptors, so the "test" file could be open in a child process when we try yo unmount

TheJonny commented 5 months ago

indeed, we are forking in test_mount_tmpfs_without_flags_allows_rwx and test_mount::test_mount_noexec_disallows_exec. these tests are likely to be executed in parallel with test_mount_bind

TheJonny commented 5 months ago

2386 fixed it for me, verified by letting while cargo test --tests --release --all-features -- mount; do : ; done run a (short) while