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

Incremental compilation warning "Error finalizing incremental compilation session directory" when building compiler on Windows #86929

Closed
rylev opened this issue Jul 7, 2021 · 8 comments
Assignees
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. O-windows Operating system: Windows

Comments

@rylev
Copy link
Member

rylev commented Jul 7, 2021

When building the compiler on Windows with incremental turned on I often get the following warning:

warning: Error finalizing incremental compilation session directory `\\?\C:\Users\ryanl\Code\rust\build\x86_64-pc-windows-msvc\stage0-rustc\x86_64-pc-windows-msvc\release\incremental\rustc_incremental-3eitboxu59x4j\s-g08srunmh1-1cw7crv-working`: Access is denied. (os error 5)

Compilation continues after this and leads to a successful build.

A similar issue has been reported before (#48700), but that is a panic during compilation of a normal crate.

@rylev rylev added O-windows Operating system: Windows A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. labels Jul 7, 2021
@ChrisDenton
Copy link
Member

Seems to be an fs::rename operation failing? The likely cause would be a file handle that is still open.

@Spidy104
Copy link

Spidy104 commented Sep 7, 2021

when will this bug be removed, and will this bug, cause major problems, for creating various stuff, cuz I am new to rust, and I continuously get this error message!

@strottos
Copy link
Contributor

strottos commented Sep 12, 2021

I get this error a lot having just moved to a Windows PC. Whilst everything clearly compiles and runs fine it's very frustrating and can cause real problems. For example, I ran cargo test under the latest tokio and tests fail as such:

ACTUAL OUTPUT:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
warning: Error finalizing incremental compilation session directory `\\?\$WORKSPACE\target\tests\target\debug\incremental\build_script_build-1pup4b7wjll7v\s-g2b8bzyb6c-xy1e9r-working`: Access is denied. (os error 5)

<actual expected output>

Elsewhere I've seen it reported as a VS Code or WSL problem and seen fixes like this proposed: #62031 (comment)
However I'm working entirely without VS Code or WSL and just running cargo build or whatever through Powershell in Windows Terminal.

@ZimCodes
Copy link

I have also received this warning as well. The solution for me was to run cargo clean and then run cargo check (as I wanted to check for more warnings/errors). From here everything was all green.

@joelswenddal
Copy link

I have also received this warning as well. The solution for me was to run cargo clean and then run cargo check (as I wanted to check for more warnings/errors). From here everything was all green.

This resolved it for me as well, moving to wsl 1 on Windows PC. Thanks!

@michaelwoerister michaelwoerister self-assigned this Mar 16, 2022
@michaelwoerister
Copy link
Member

I'll try to take a look at this.

michaelwoerister added a commit to michaelwoerister/rust that referenced this issue Mar 25, 2022
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 25, 2022
…on-dir, r=oli-obk

incr. comp.: Let compiler retry finalizing session directory a few times.

In my local testing this fixed issue rust-lang#86929. I wasn't able to come up with a regression test for it though.
@michaelwoerister
Copy link
Member

I haven't seen any reports about this after #95304 was merged. Closing.

compiler-errors added a commit to compiler-errors/rust that referenced this issue Feb 3, 2023
…loading, r=petrochenkov

Retry opening proc-macro DLLs a few times on Windows.

On Windows, the compiler [sometimes](https://users.rust-lang.org/t/error-loadlibraryexw-failed/77603) fails with the message `error: LoadLibraryExW failed` when trying to load a proc-macro crate. The error seems to occur intermittently, similar to rust-lang#86929, however, it seems to be almost impossible to reproduce outside of CI environments and thus very hard to debug. The fact that the error only occurs intermittently makes me think that this is a timing related issue.

This PR is an attempt to mitigate the issue by letting the compiler retry a few times when encountering this specific error (which resolved the issue described in rust-lang#86929).
@Moth-Tolias
Copy link

just encountered this on windows 8. the clean/check thing seems to have worked though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

8 participants