rust-lang / rust-lang/cargo

Cargo lock on build directory does not work on NFS

Open
#4,629 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-filesystem A-layout S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

When run on a project located on a NFS mount, cargo fails to lock the build directory.

Expected behavior:

# cd /tmp
# cargo new --bin bin
     Created binary (application) `bin` project
# cd bin
# cargo run & cargo run
    Blocking waiting for file lock on build directory
   Compiling bin v0.1.0 (file:///tmp/bin)
    Finished dev [unoptimized + debuginfo] target(s) in 0.57 secs
     Running `target/debug/bin`
Hello, world!
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/bin`
Hello, world!

Actual behavior (my /home is NFSv4 mounted, with no lock-related options on the mount):

# cd $HOME/src
# cargo new --bin bin
     Created binary (application) `bin` project
# cd bin
# cargo run & cargo run
   Compiling bin v0.1.0 (file:///home/bruce/src/bin)
   Compiling bin v0.1.0 (file:///home/bruce/src/bin)
error: failed to remove /home/bruce/src/bin/target/debug/deps/bin-291ef6a9e055a048.0.o: No such file or directory (os error 2)

error: failed to remove /home/bruce/src/bin/target/debug/deps/bin-291ef6a9e055a048.crate.metadata.o: No such file or directory (os error 2)

error: failed to remove /home/bruce/src/bin/target/debug/deps/bin-291ef6a9e055a048.crate.allocator.o: No such file or directory (os error 2)

    Finished dev [unoptimized + debuginfo] target(s) in 0.90 secs
     Running `target/debug/bin`
    Finished dev [unoptimized + debuginfo] target(s) in 0.96 secs
     Running `target/debug/bin`
Hello, world!
Hello, world!

I'm using cargo 0.22.0 (3423351a5 2017-10-06) on Gentoo Linux, kernel 4.9.52.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by running two cargo run commands concurrently for a project on an NFS mount, comparing it with the /tmp example. Investigate Cargo's build-directory locking behavior and the reported missing object-file removals. Done means concurrent builds on NFS serialize correctly without the errors shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.