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

Catch Panic Configuration #85

Merged
merged 5 commits into from
Feb 13, 2016
Merged

Catch Panic Configuration #85

merged 5 commits into from
Feb 13, 2016

Conversation

Drakulix
Copy link
Collaborator

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 the Coroutine::spawned function.

Additionally sending the panic requires the thread_id to access the right Mio::Sender, which was added to HandlerShared.

@@ -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
Copy link
Owner

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"?

Copy link
Collaborator Author

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.

Copy link
Owner

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.

@dpc
Copy link
Owner

dpc commented Feb 11, 2016

Something went wrong and the hang seems real. I'm investigating if it was your patch, or previously unknown problem.

@dpc
Copy link
Owner

dpc commented Feb 11, 2016

Travis failed without your patch. So something else, it seems.

@Drakulix
Copy link
Collaborator Author

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.

dpc added a commit that referenced this pull request Feb 13, 2016
@dpc dpc merged commit 79bd084 into dpc:master Feb 13, 2016
@dpc
Copy link
Owner

dpc commented Feb 13, 2016

Travis hanged, looks like the existing issue yet to be fixed, so merged. Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants