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

Rustc file lock not working on WSL #72157

Closed
nbdd0121 opened this issue May 12, 2020 · 2 comments · Fixed by #72161
Closed

Rustc file lock not working on WSL #72157

nbdd0121 opened this issue May 12, 2020 · 2 comments · Fixed by #72161
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows Operating system: Windows

Comments

@nbdd0121
Copy link
Contributor

nbdd0121 commented May 12, 2020

WSL1 does not support fcntl-based advisory locks, therefore the current src/librustc_data_structures/flock.rs implementation does not work.

This issue can be observed by running cargo doc on a repository with many crates. The search-index.js can miss crates.

According to my test libc::flock is working on WSL. We could replace fcntl based lock with flock based lock for Linux. However this will break lock over NFS for Linux 2.6.11 or earlier, I can author a PR if that's okay.

Related WSL issue: microsoft/WSL#1927

@cuviper
Copy link
Member

cuviper commented May 12, 2020

However this will break lock over NFS for Linux 2.6.11 or earlier

The minimum platform support is Linux 2.6.18, so that seems fine. If we can get away with switching all unix hosts to flock, even better.

@nbdd0121
Copy link
Contributor Author

The minimum platform support is Linux 2.6.18, so that seems fine.

Cool.

If we can get away with switching all unix hosts to flock, even better.

Sure.

@Elinvynia Elinvynia added C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows Operating system: Windows labels May 20, 2020
RalfJung added a commit to RalfJung/rust that referenced this issue May 22, 2020
Replace fcntl-based file lock with flock

WSL1 does not support `fcntl`-based lock and will always report success,
therefore creating a race condition when multiple rustc processes are
modifying shared data such as `search-index.js`. WSL1 does however
support `flock`.

`flock` is supported by all unix-like platforms. The only caveat is that
Linux 2.6.11 or earlier does not support `flock` on NFS mounts, but as
the minimum supported Linux version is 2.6.18, it is not an issue.

Fixes rust-lang#72157
@bors bors closed this as completed in a23dd0d May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows Operating system: Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants