-
Notifications
You must be signed in to change notification settings - Fork 30
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
Catch Panic Configuration #85
Conversation
@@ -997,6 +1003,7 @@ impl Coroutine { | |||
extern "C" fn init_fn(arg: usize, _: *mut libc::types::common::c95::c_void) -> ! { | |||
let ctx: &Context = { | |||
|
|||
//never panic inside the coroutine, that causes a SIGILL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this comment. Do you mean "never panic inside init_fn"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Isn't init_fn the actual Coroutine? Sorry if that comment is misleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it executes in the coroutine at the begining. But you can panic in the rest of coroutine, just not in the init_fn itself.
Something went wrong and the hang seems real. I'm investigating if it was your patch, or previously unknown problem. |
Travis failed without your patch. So something else, it seems. |
I have answered all your comments. Once that travis build error is sorted out, I will push the name and comment changes to trigger a new build. |
Travis hanged, looks like the existing issue yet to be fixed, so merged. Thanks! |
This PR adds runtime configuration of catching panics.
When no catching is enabled, that panic is actually still catched, because coroutine-rs does execute the init_fn in a foreign function context, causing a SIGILL if a panic would occure. Instead the panic is then passed to the
mio::EventLoop
, where it is propageted to get a nice backtrace.Panic catching is configurable through the
Config
struct, but the actual flag is passed into each coroutine to be able to read it inside theCoroutine::spawned
function.Additionally sending the panic requires the
thread_id
to access the rightMio::Sender
, which was added toHandlerShared
.