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

Use catch_unwind() to catch actor panics #77

Open
strohel opened this issue May 17, 2023 · 1 comment
Open

Use catch_unwind() to catch actor panics #77

strohel opened this issue May 17, 2023 · 1 comment

Comments

@strohel
Copy link
Member

strohel commented May 17, 2023

We could unconditionally convert actor panics into actor system shutdown, or perhaps allow users to supply a callback that decides the fate.

@mbernat
Copy link
Contributor

mbernat commented Mar 22, 2024

I think catch_unwind is the recommended way to handle subsystem panics, whether that's request handling in web servers or actors in an actor system.

One potential issue is that the subsystem's result type needs to be UnwindSafe, which is similar to Send / Sync thread safety. For portal this means that the Actor::Error type needs to be UnwindSafe and it seems all actors use anyhow::Error, which is indeed UnwindSafe 😌

I don't think it's optimal to make errors/panics trigger system shutdown (as opposed to just actor restart) but it seems reasonable to treat errors and panics the same for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants