-
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
rustc hangs after ICEing due to memory limit #110771
Comments
cc @Amanieu |
Maybe related, maybe not. I just ran into a hang in backtraces when working on something else:
In my case this was due to a logic bug I introduced, but the same place could panic due to allocation failure. |
I can't reproduce this on my machine. Looking at the backtrace from @the8472, this seems to be happening because a second panic occurred while executing a panic hook, which led to a deadlock on an internal lock used by the backtrace mechanism. I think the proper solution here is to skip executing the panic hook and immediately abort if a panic occurred while executing a panic hook. |
…manieu Revert panic oom This temporarily reverts rust-lang#109507 until rust-lang#110771 is addressed r? `@Amanieu`
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium +T-compiler |
Rework handling of recursive panics This PR makes 2 changes to how recursive panics works (a panic while handling a panic). 1. The panic count is no longer used to determine whether to force an immediate abort. This allows code like the following to work without aborting the process immediately: ```rust struct Double; impl Drop for Double { fn drop(&mut self) { // 2 panics are active at once, but this is fine since it is caught. std::panic::catch_unwind(|| panic!("twice")); } } let _d = Double; panic!("once"); ``` Rustc already generates appropriate code so that any exceptions escaping out of a `Drop` called in the unwind path will immediately abort the process. 2. Any panics while the panic hook is executing will force an immediate abort. This is necessary to avoid potential deadlocks like rust-lang#110771 where a panic happens while holding the backtrace lock. We don't even try to print the panic message in this case since the panic may have been caused by `Display` impls. Fixes rust-lang#110771
Rework handling of recursive panics This PR makes 2 changes to how recursive panics works (a panic while handling a panic). 1. The panic count is no longer used to determine whether to force an immediate abort. This allows code like the following to work without aborting the process immediately: ```rust struct Double; impl Drop for Double { fn drop(&mut self) { // 2 panics are active at once, but this is fine since it is caught. std::panic::catch_unwind(|| panic!("twice")); } } let _d = Double; panic!("once"); ``` Rustc already generates appropriate code so that any exceptions escaping out of a `Drop` called in the unwind path will immediately abort the process. 2. Any panics while the panic hook is executing will force an immediate abort. This is necessary to avoid potential deadlocks like rust-lang#110771 where a panic happens while holding the backtrace lock. We don't even try to print the panic message in this case since the panic may have been caused by `Display` impls. Fixes rust-lang#110771
Rework handling of recursive panics This PR makes 2 changes to how recursive panics works (a panic while handling a panic). 1. The panic count is no longer used to determine whether to force an immediate abort. This allows code like the following to work without aborting the process immediately: ```rust struct Double; impl Drop for Double { fn drop(&mut self) { // 2 panics are active at once, but this is fine since it is caught. std::panic::catch_unwind(|| panic!("twice")); } } let _d = Double; panic!("once"); ``` Rustc already generates appropriate code so that any exceptions escaping out of a `Drop` called in the unwind path will immediately abort the process. 2. Any panics while the panic hook is executing will force an immediate abort. This is necessary to avoid potential deadlocks like rust-lang#110771 where a panic happens while holding the backtrace lock. We don't even try to print the panic message in this case since the panic may have been caused by `Display` impls. Fixes rust-lang#110771
Revert panic oom This temporarily reverts rust-lang/rust#109507 until rust-lang/rust#110771 is addressed r? `@Amanieu`
Revert panic oom This temporarily reverts rust-lang/rust#109507 until rust-lang/rust#110771 is addressed r? `@Amanieu`
Revert panic oom This temporarily reverts rust-lang/rust#109507 until rust-lang/rust#110771 is addressed r? `@Amanieu`
I use
prlimit
to limit rustcs memory usage and max runtime per thread (like a light sandboxing basically) and I have a giantfiles.par_iter().for_each(|file| rustc_flags.iter(|flag| exec( prlimit_run rustc flag file.rs))).collect::vec<ICE>();
loopI run
prlimit --noheadings --as=3076000000 --cpu=30 rustc file flags
, so a rustc process is limited to roughly 3 gb of ram and 30 seconds of cpu time.I noticed that after 39cf520 #109507 (I bisected this), my rayon loop would sometimes get stuck randomly.
It was very weird because there was no cpu load, just as if someone had temporarily suspended one of the rayon threads and now we'd wait for it/them to finish indefinitely.
I can reproduce the problem
tests/ui/limits/huge-struct.rs
for example:This causes rustc to be killed by prlimit because it would hit the memory limit, sometimes its backtrace is much shorter than usual
and my console would not be freed, so there is still something running.
You may need to run this a couple of times to hit the hang.
The text was updated successfully, but these errors were encountered: