-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Display lockfile path in very verbose mode when blocking #16491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I'm unsure if a test is required for this change and where it should go if required. I was thinking maybe in testsuite/concurrent.rs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure if a test is required for this change and where it should go if required. I was thinking maybe in testsuite/concurrent.rs.
Either there or here in tests/testsuite/cache_lock.rs. We do have some tests around that but pretty brutal:
cargo/tests/testsuite/cache_lock.rs
Lines 72 to 99 in a374e43
| /// Helper to verify that acquiring the given mode would block. | |
| /// | |
| /// Always call `thread_wait_timeout` on the result. | |
| #[must_use] | |
| fn verify_lock_would_block(mode: CacheLockMode) -> JoinHandle<()> { | |
| let root = paths::root(); | |
| // Spawn a thread that will block on the lock. | |
| let thread = std::thread::spawn(move || { | |
| let gctx = GlobalContextBuilder::new().root(root).build(); | |
| let locker2 = CacheLocker::new(); | |
| let lock2 = locker2.lock(&gctx, mode).unwrap(); | |
| assert!(locker2.is_locked(mode)); | |
| drop(lock2); | |
| }); | |
| // Verify that it blocked. | |
| retry(100, || { | |
| if let Ok(s) = std::fs::read_to_string(paths::root().join("shell.out")) { | |
| if s.trim().starts_with("Blocking waiting for file lock on") { | |
| return Some(()); | |
| } else { | |
| eprintln!("unexpected output: {s}"); | |
| // Try again, it might have been partially written. | |
| } | |
| } | |
| None | |
| }); | |
| thread | |
| } |
cargo/tests/testsuite/global_cache_tracker.rs
Lines 1308 to 1319 in a374e43
| // Wait for clean to finish. | |
| let thread = std::thread::spawn(|| clean_child.wait_with_output().unwrap()); | |
| let output = thread_wait_timeout(100, thread); | |
| assert!(output.status.success()); | |
| // Validate the output of the clean. | |
| execs() | |
| .with_stderr_data(str![[r#" | |
| [BLOCKING] waiting for file lock on package cache mutation | |
| [REMOVED] [FILE_NUM] files, [FILE_SIZE]B total | |
| "#]]) | |
| .run_output(&output); |
26b52a2 to
9b7b4e9
Compare
9b7b4e9 to
a34fb1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Update cargo submodule 5 commits in 8c133afcd5e0d69932fe11f5907683723f8d361d..6d1bd93c47f059ec1344cb31e68a2fb284cbc6b1 2026-01-09 03:50:15 +0000 to 2026-01-10 12:53:59 +0000 - fix: preserve `dep_name` for build script metadata (rust-lang/cargo#16494) - refactor(toml): clarify `to_dependency` for config patch (rust-lang/cargo#16492) - Add `--id` flag to `cargo report timings` and `cargo report rebuilds` (rust-lang/cargo#16490) - Display lockfile path in very verbose mode when blocking (rust-lang/cargo#16491) - fix(info): resolve underscore vs hyphen mismatch in schema lookup (rust-lang/cargo#16455) --- An extra submodule update right after <#150739> due to a relatively impactful nightly regression <rust-lang/cargo#16493>
Update cargo submodule 5 commits in 8c133afcd5e0d69932fe11f5907683723f8d361d..6d1bd93c47f059ec1344cb31e68a2fb284cbc6b1 2026-01-09 03:50:15 +0000 to 2026-01-10 12:53:59 +0000 - fix: preserve `dep_name` for build script metadata (rust-lang/cargo#16494) - refactor(toml): clarify `to_dependency` for config patch (rust-lang/cargo#16492) - Add `--id` flag to `cargo report timings` and `cargo report rebuilds` (rust-lang/cargo#16490) - Display lockfile path in very verbose mode when blocking (rust-lang/cargo#16491) - fix(info): resolve underscore vs hyphen mismatch in schema lookup (rust-lang/cargo#16455) --- An extra submodule update right after <#150739> due to a relatively impactful nightly regression <rust-lang/cargo#16493>
Update cargo submodule 5 commits in 8c133afcd5e0d69932fe11f5907683723f8d361d..6d1bd93c47f059ec1344cb31e68a2fb284cbc6b1 2026-01-09 03:50:15 +0000 to 2026-01-10 12:53:59 +0000 - fix: preserve `dep_name` for build script metadata (rust-lang/cargo#16494) - refactor(toml): clarify `to_dependency` for config patch (rust-lang/cargo#16492) - Add `--id` flag to `cargo report timings` and `cargo report rebuilds` (rust-lang/cargo#16490) - Display lockfile path in very verbose mode when blocking (rust-lang/cargo#16491) - fix(info): resolve underscore vs hyphen mismatch in schema lookup (rust-lang/cargo#16455) --- An extra submodule update right after <rust-lang/rust#150739> due to a relatively impactful nightly regression <rust-lang/cargo#16493>
Update cargo submodule 5 commits in 8c133afcd5e0d69932fe11f5907683723f8d361d..6d1bd93c47f059ec1344cb31e68a2fb284cbc6b1 2026-01-09 03:50:15 +0000 to 2026-01-10 12:53:59 +0000 - fix: preserve `dep_name` for build script metadata (rust-lang/cargo#16494) - refactor(toml): clarify `to_dependency` for config patch (rust-lang/cargo#16492) - Add `--id` flag to `cargo report timings` and `cargo report rebuilds` (rust-lang/cargo#16490) - Display lockfile path in very verbose mode when blocking (rust-lang/cargo#16491) - fix(info): resolve underscore vs hyphen mismatch in schema lookup (rust-lang/cargo#16455) --- An extra submodule update right after <rust-lang/rust#150739> due to a relatively impactful nightly regression <rust-lang/cargo#16493>
What does this PR try to resolve?
Addresses #15094
When waiting on a lock, the path to the lockfile is displayed when
-vvis passed.