Skip to content

Server gets stuck, apparently due to broken Cargo metadata #6589

@djc

Description

@djc

So I've run an issue a few times now over the last few weeks where my cargo check commands in the terminal get stuck for a very long time (sometimes minutes) blocking on "waiting for file lock on package cache". I just had this happen to me again, and decided to dig in a little. I now think this might be happening when RA tries to read my Cargo.toml file just as I'm editing it. This gets it into an error state, like this:

[ERROR rust_analyzer::reload] failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /Users/djc/src/ids-rs/Cargo.toml, cargo 1.47.0 (f3c7e066a 2020-08-28): Failed to run `cargo metadata --manifest-path /Users/djc/src/ids-rs/Cargo.toml`: Error during execution of `cargo metadata`: error: failed to parse manifest at `/Users/djc/src/ids-rs/nominl/Cargo.toml`

Caused by:
  could not parse input as TOML

Caused by:
  newline in string found at line 24 column 96

[ERROR flycheck] Flycheck failed to run the following command: "cargo" "check" "--workspace" "--message-format=json" "--manifest-path" "/Users/djc/src/ids-rs/Cargo.toml" "--all-targets" "--all-features"
[ERROR rust_analyzer::main_loop] cargo check failed: Cargo watcher failed, the command produced no valid metadata (exit code: ExitStatus(ExitStatus(25856)))

After this, it looks like it eventually recover, but it's taking very long to do so (maybe some timeout?) -- and all the while it appears to be holding the package cache file lock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-supportCategory: support questionsS-unactionableIssue requires feedback, design decisions or is blocked on other work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions