-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 check runs forever and memory usage grows unboundedly #116914
Comments
Good news! this commit has no dependencies and still reproduces the issue. |
minimal repro, if you delete everything with |
Some quick poking with a debugger suggests that the compiler is endlessly emitting diagnostics. If this is a regression it isn't recent. This hangs on builds back to 1.60. |
Running the repro with I did a quick and dirty test to check for |
I think we're running into this on Fuchsia, which may take a long time for us to make a reproduction, but I can try to explain what we're seeing. We're on This sounds pretty analogous to a exponential expansion bug that was fixed in #114948. Perhaps diagnostics also needs to add something similar do avoid the same thing? |
Not that it matters much but this looks quite old: it used to trigger a solving overflow but seems to have started infinite looping in |
Does turning
I ask because I want to see if it's the same as my issue: I've been having a similar problem with cargo build only in dev profile spiking very sharply to 24 GiB during the build, and after trying some of the differences in profiles, I can now safely build and check in dev without a memory explosion, just by turning off overflow-checks. (More details) |
@Zannick You're probably seeing a different issue. Here, the infinite loop is related to error diagnostics and trait solving. |
@rustbot label -E-needs-mcve Triage: #116914 (comment) is a MCVE for this |
I wonder if an early error checking for these unconditionally recursive definitions might be worth it while we track down the right place to fix this correctly. |
Apologies, I really couldn't find a way to minimise this example, but this commit causes
cargo check
to run forever and consume an ever-growing amount of memory. I tried to narrow down what was causing the problem, but just pulling the various trait definitions out into another crate didn't reproduce it. I think the issue is related to (almost certainly) poorly-defined associated type bounds in the various traits undersrc/proxy/routes
, as it seemed to start happening after I started adding those, but I'm really not very confident in that assessment.I expected to see this happen:
cargo check
would run in a bounded amount of space and timeInstead, this happened:
cargo check
seems to run forever and consume all of my memoryI can confirm the issue occurs on both nightly and stable, with versions:
rustc --version --verbose
:rustc --version --verbose
:I can't include a backtrace because, naturally, the compiler doesn't exit, so setting
RUST_BACKTRACE=1
has no effectThis is a screenshot of rustc consuming 23GB of ram while compiling the linked commit. I don't know why I thought this would be useful, but I guess I did, so here it is.
The text was updated successfully, but these errors were encountered: