Skip to content
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

spurious ci failure: The process cannot access the file because it is being used by another process #127126

Closed
matthiaskrgr opened this issue Jun 29, 2024 · 1 comment · Fixed by #127152
Labels
A-spurious Area: Spurious failures in builds (spuriously == for no apparent reason) C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@matthiaskrgr
Copy link
Member

See https://github.com/rust-lang/rust/pulls?q=is%3Apr+%22The+process+cannot+access+the+file+because+it+is+being+used+by+another+process%22+is%3Aclosed

seems to happen on x86_64-msvc-exta lot

[RUSTC-TIMING] miri test:false 64.073
[RUSTC-TIMING] miri test:false 2.939
    Finished `release` profile [optimized] target(s) in 0.39s
thread 'main' panicked at src/lib.rs:1697:17:
failed to copy `C:\a\rust\rust\build\x86_64-pc-windows-msvc\stage1-tools\x86_64-pc-windows-msvc\release\miri.exe` to `C:\a\rust\rust\build\x86_64-pc-windows-msvc\stage1-tools-bin\miri.exe`: The process cannot access the file because it is being used by another process. (os error 32)
##[endgroup]
Build completed unsuccessfully in 0:00:11
  local time: Sat, Jun 29, 2024  5:48:11 PM
  network time: Sat, 29 Jun 2024 17:48:11 GMT
@matthiaskrgr matthiaskrgr added A-spurious Area: Spurious failures in builds (spuriously == for no apparent reason) C-bug Category: This is a bug. labels Jun 29, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 29, 2024
@ChrisDenton
Copy link
Member

ChrisDenton commented Jun 29, 2024

The bootstrap code that panics hasn't changed in years:

rust/src/bootstrap/src/lib.rs

Lines 1696 to 1698 in d1b7355

if let Err(e) = fs::copy(&src, dst) {
panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e)
}
so I doubt that's the cause but a workaround would be to add a retry loop.

It would be interesting to know what's changed recently to cause this. "os error 32" is a sharing violation, which is usually because the file is locked in certain way. But, as far as I'm aware, we don't do that kind of locking. Maybe someone who knows bootstrap well has some ideas.

Edit: I guess it could be a cargo issue and not bootstrap
Edit2: Worse case it's a CI thing where some sort of malware scanner is locking the file

@ChrisDenton ChrisDenton added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Jun 29, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 30, 2024
Bootstrap: Retry copying/linking

May be a workaround for rust-lang#127126. But it's hard to know if this works due to the error only appearing some times.

This just adds a retry loop with a fairly long pause between retries so as to give time to whatever is locking the file to give up its lock.

try-job: x86_64-msvc-ext
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 30, 2024
Bootstrap: Try renaming the file if removing fails

Second attempt at working around rust-lang#127126

If we can't remove the file, then try renaming it. This will leave the destination path free to use.

try-job: x86_64-msvc-ext
@ChrisDenton ChrisDenton linked a pull request Jun 30, 2024 that will close this issue
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 1, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 2, 2024
Bootstrap: Try renaming the file if removing fails

Second attempt at working around rust-lang#127126

If we can't remove the file, then try renaming it. This will leave the destination path free to use.

try-job: x86_64-msvc-ext
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 2, 2024
Bootstrap: Try renaming the file if removing fails

Second attempt at working around rust-lang#127126

If we can't remove the file, then try renaming it. This will leave the destination path free to use.

try-job: x86_64-msvc-ext
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Jul 4, 2024
Bootstrap: Try renaming the file if removing fails

Second attempt at working around rust-lang/rust#127126

If we can't remove the file, then try renaming it. This will leave the destination path free to use.

try-job: x86_64-msvc-ext
lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Jul 11, 2024
Bootstrap: Try renaming the file if removing fails

Second attempt at working around rust-lang/rust#127126

If we can't remove the file, then try renaming it. This will leave the destination path free to use.

try-job: x86_64-msvc-ext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-spurious Area: Spurious failures in builds (spuriously == for no apparent reason) C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants