Skip to content

Cargo-update: exceedingly slow progress on update when local registry/index is used and git-fetch-with-cli is false #9167

@datdenkikniet

Description

@datdenkikniet

Problem

When using a local registry located at /home/user/rust/crates.io-index (which is simply a clone of https://github.com/rust-lang/crates.io-index.git) , specified in ~/.cargo/config using the following config:

[source]

[source.mirror]
registry = "file:///home/user/rust/crates.io-index"

[source.crates-io]
replace-with = "mirror"

is used, cargo update progresses incredibly slowly, consumes 1 CPU and slowly increases its RAM usage, given that the project has at least one dependency. That's to say: when running cargo update the process takes very long.

The total update time was 21 minutes.

However, when ~/.cargo/config is changed to

[net]
git-fetch-with-cli = true

[source]

[source.mirror]
registry = "file:///home/jona/projects/rust/crates.io-index"

[source.crates-io]
replace-with = "mirror"

the update actually succeeds relatively quickly, which is the expected behaviour. With this option, the update took about 21 seconds.
Steps

  1. Install rust
  2. Clone https://github.com/rust-lang/crates.io-index.git
  3. Edit/add the local source and overriding of the crates-io source to ~/.cargo/config using the first of the above examples. Point the mirror source to the directory into which crates.io-index was cloned.
  4. Create an empty/basic project
  5. Add a dependency to this project (I used time = "0.1.0", but as far as I can tell any dependency that triggers an update of the registry will cause this issue)
  6. Attempt to run cargo update

Possible Solution(s)

Use

[net]
git-fetch-with-cli = true

in cargo configuration.

Notes

Output of cargo version:
I tested found the issue on 1.46.0, 1.49.0 (d00d64d 2020-12-05), and 1.50.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitC-bugCategory: bugPerformanceGotta go fast!S-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions