-
Notifications
You must be signed in to change notification settings - Fork 50
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 the whole process if we see a Rust panic #80
Comments
The proposed solution to this is to raise a JNI exception. However, my main concern is if this is safe to do from the Rust calling context, since it may cause the stack to unwind with unpredictable results. |
I'm not sure what kind of unwind you're thinking of with "may cause the stack to unwind with unpredictable results". This would be for functions that are being called as native methods by the JVM (Activity methods like On the Rust side we can still use There shouldn't be any uncontrolled unwind on the Rust side, and the Java exception should be controlled too? The things I'm not sure about with this though are:
I was also pondering calling |
PR #68 introduces an
abort_on_panic
wrapper to ensure that a panic in Rust can't unwind over an FFI boundary, since that leads to undefined behaviour.A problem with this solution though is that an Android Activity doesn't necessarily own the entire process, in case there may be other Services or even Activities running in the same process in separate threads and so we're potentially tearing down more than should be necessary by aborting the whole process.
The text was updated successfully, but these errors were encountered: