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

Don't abort in panic hook #22467

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Don't abort in panic hook #22467

wants to merge 1 commit into from

Conversation

cole-miller
Copy link
Contributor

@cole-miller cole-miller commented Dec 28, 2024

This makes it impossible to catch_unwind, including in dependencies. There might be a reason I'm not thinking of to abort here; if so, we might want to consider building with panic=abort instead since this also decreases the binary size (and maybe helps compile times?).

Release Notes:

  • N/A

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 28, 2024
@ConradIrwin
Copy link
Member

The main thing to be sure is that the process still exits on a normal panic.

Catch unwind seems like a dangerous game in any case, but there are definitely good uses for it

@cole-miller
Copy link
Contributor Author

The process will still exit on panic with this change, since the panic hook is called before unwinding begins. So I think we should do it if we value catch_unwind (in the few cases where it's appropriate to reach for it).

If we can (continue to) live without catch_unwind, switching to panic=abort has the following effect as measured (crudely) on my Linux machine:

panic setting scratch debug build time stripped release binary size
unwind 326s 205 MB
abort 289s (11% faster) 176 MB (14% smaller)

So I'm definitely somewhat tempted to go that route.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants