Skip to content
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

std panicking implementation comments suggest we might make double-panic not abort #98953

Open
CAD97 opened this issue Jul 5, 2022 · 1 comment
Labels
A-technical-debt Area: Internal cleanup work C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@CAD97
Copy link
Contributor

CAD97 commented Jul 5, 2022

if panics > 1 || !can_unwind {
// If a thread panics while it's already unwinding then we
// have limited options. Currently our preference is to
// just abort. In the future we may consider resuming
// unwinding or otherwise exiting the thread cleanly.
rtprintpanic!("thread panicked while panicking. aborting.\n");
crate::sys::abort_internal();
}

At this point, I think we've effectively guaranteed in practice that a panicking while already unwinding leads to a full-process abort, and changing this to attempt to unwind the inner panic or even just to abort the thread but not the whole process is likely far to breaking. We're even considering making unwinds from drops always abort, though AIUI this cannot replace the panic while unwinding immediate abort check.

Best guess at appropriate labels...

@rustbot modify labels +T-compiler +T-lang +C-cleanup +A-technical-debt

@rustbot rustbot added A-technical-debt Area: Internal cleanup work C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Jul 5, 2022
@peter-lyons-kehl
Copy link
Contributor

peter-lyons-kehl commented Aug 18, 2024

Thank you. The unrealistic comment has been removed. See

if !can_unwind {
// If a thread panics while running destructors or tries to unwind
// through a nounwind function (e.g. extern "C") then we cannot continue
// unwinding and have to abort immediately.
rtprintpanic!("thread caused non-unwinding panic. aborting.\n");
crate::sys::abort_internal();
}
. I believe this issue may be closed.

Not related to this issue, but while on this topic: Yesterday I've read somewhere in the std source, or in std or Cargo (nightly) docs, that in Cargo.toml > profile.xxx, in addition to panic=abort and panic=unwind Rust may consider other panic strategies in the future (I don't remember exact wording). Today I've been searching for it, but I can't locate it anymore. Any idea where?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-technical-debt Area: Internal cleanup work C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants