-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Incremental compilation OOM #139142
Comments
I have followed the directions and cannot reproduce an OOM on nightly or stable. |
Strange... Is there anything I can do on my end to maybe help get a dump to investigate what may be going on? I tried some heap profiling tools before but I could never get it to actually capture a majority of the data (likely my own inexperience with such tools), so I'm not sure what's going wrong in capturing said dump, so if there's anything I can do to provide something useful let me know. |
If it helps too - there is also a hilariously deep backtrace I can get with a debugger that's at least 600,000 entries deep. A lot of the lines are just this repeating
|
I can reproduce this on the latest nightly, will try to minimize it |
reduction, reproducible with fn main() {
#[cfg(a)]
|| ();
|| {
Some(())
.map(|_| ())
.map(|y| y);
};
async || {};
} @rustbot label S-has-mcve A-closures A-async-closures |
reducing further to leave only closures removes the hang, but generates a nonsensical cycle error (only with incr comp too): fn main() {
#[cfg(a)]
|| ();
|| {
|| ();
|| ();
};
async || {};
}
|
Rollup merge of rust-lang#139153 - compiler-errors:incr-comp-closure, r=oli-obk Encode synthetic by-move coroutine body with a different `DefPathData` See the included test. In the first revision rpass1, we have an async closure `{closure#0}` which has a coroutine as a child `{closure#0}::{closure#0}`. We synthesize a by-move coroutine body, which is `{closure#0}::{closure#1}` which depends on the mir_built query, which depends on the typeck query. In the second revision rpass2, we've replaced the coroutine-closure by a closure with two children closure. Notably, the def path of the second child closure is the same as the synthetic def id from the last revision: `{closure#0}::{closure#1}`. When type-checking this closure, we end up trying to compute its def_span, which tries to fetch it from the incremental cache; this will try to force the dependencies from the last run, which ends up forcing the mir_built query, which ends up forcing the typeck query, which ends up with a query cycle. The problem here is that we really should never have used the same `DefPathData` for the synthetic by-move coroutine body, since it's not a closure. Changing the `DefPathData` will mean that we can see that the def ids are distinct, which means we won't try to look up the closure's def span from the incremental cache, which will properly skip replaying the node's dependencies and avoid a query cycle. Fixes rust-lang#139142
This comes from the bug report DioxusLabs/dioxus#3903 with DioxusLabs/dioxus#3903 (comment) being especially relevant.
I have no idea how to diagnose this, and there is no real crash - just an OOM that requires the linux OOM killer step in.
It feels like the borrow checker freaking out?Probably an incorrect guessThis does not appear to be related to macro expansion, which is what the original report's title says - this seems to occur well after expansion. While the sample code does still contain a macro, expanding beyond this still reproduces the issue.
This occurs both on stable (
1.85.1
) and latest nightly (920d95eaf 2025-03-28
) as of my most recent test.I'm happy to rewrite this bug report, I just have no idea where to start in actually trying to diagnose this (I lack knowledge on tooling etc for bugs like this) - it eats about 1GB/s if you let it, and ate all 96GB of RAM I have installed, but I'm not sure how to instrument it.
The linked issue has a sample project that reproduces this, with reproduction instructions in the initial bug report.
The text was updated successfully, but these errors were encountered: