-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo-update: exceedingly slow progress on update when local registry/index is used and git-fetch-with-cli is false #9167
Comments
Thanks for the report. I have noticed this, too, and it can be extremely slow. Unfortunately I think this is an issue with libgit2 (libgit2/libgit2#2836). For now, |
Super slow on https git pulls on macos here. Spent a while trying different things... this worked for me.
|
@romecode good to see that you have fixed your problem, but I don't think your solution is relevant to this issue. I've edited the issue itself to clearly include the workaround for the problem. |
Thanks. This fixed extremely slow 'Updating crates.io index' for me on Arch |
in my situation, in addition to taking a bunch of CPU the update also allocated ~8.6GB of ram which was not freed after the update (eventually leading to OOM). using the workaround above worked great |
It even leads to out of memory exceptions, when cross compiling in an alpine arm container in github actions: (fixed with |
FWIW, there is an ongoing project on integrating gitoxide1 to replace some uses of libgit2 in Cargo. I wouldn't say it will be landed soon but we can keep a eye on it, and maybe help @Byron if needed. Footnotes
|
Edit: It also turns out that part of the slowness comes from |
Set your source to this mirror. It worked for me [source.tuna] |
Thanks for thinking along @dxspro28, but that solution is irrelevant to the problem described here. Configuring the registry to be some other online source is not a solution when one wishes to use a local registry. Additionally, unless the registry located at |
It looks like docker build was killed because it used too much memory while updating the registry index, when forcing cargo to use cli, I could pass the step when the index is updated and successfully build the image. Fixes #1559 It seems related to rust-lang/cargo#9167
Problem
When using a local registry located at
/home/user/rust/crates.io-index
(which is simply a clone ofhttps://github.com/rust-lang/crates.io-index.git
) , specified in~/.cargo/config
using the following config: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 runningcargo update
the process takes very long.The total update time was 21 minutes.
However, when
~/.cargo/config
is changed tothe update actually succeeds relatively quickly, which is the expected behaviour. With this option, the update took about 21 seconds.
Steps
https://github.com/rust-lang/crates.io-index.git
~/.cargo/config
using the first of the above examples. Point the mirror source to the directory into whichcrates.io-index
was cloned.time = "0.1.0"
, but as far as I can tell any dependency that triggers an update of the registry will cause this issue)cargo update
Possible Solution(s)
Use
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.
The text was updated successfully, but these errors were encountered: