-
Notifications
You must be signed in to change notification settings - Fork 630
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
Fix to prevent event machine from stopping when a raise is done in an unbind. #327
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…unbind. Eventmachine IS stopped when an exception is raised while eventmachine is stopping.
sodabrew
added a commit
that referenced
this pull request
Nov 2, 2015
Fix to prevent event machine from stopping when a raise is done in an unbind
Closed
sodabrew
added a commit
to sodabrew/eventmachine
that referenced
this pull request
Apr 28, 2018
… must be prevented
sodabrew
added a commit
to sodabrew/eventmachine
that referenced
this pull request
Apr 28, 2018
The unbind callback absolutely must not raise an exception or the reactor will crash. If there is no EM.error_handler, or if the error_handler retrows, then stop the reactor, stash the exception in $wrapped_exception, and the exception will be raised after the reactor is cleaned up (see the last line of self.run). This fixes many crash reports in the 1.2 series since eventmachine#327 was merged.
Merged
sodabrew
added a commit
to sodabrew/eventmachine
that referenced
this pull request
Apr 28, 2018
The unbind callback absolutely must not raise an exception or the reactor will crash. If there is no EM.error_handler, or if the error_handler retrows, then stop the reactor, stash the exception in $wrapped_exception, and the exception will be raised after the reactor is cleaned up (see the last line of self.run). This fixes many crash reports in the 1.2 series since eventmachine#327 was merged.
sodabrew
added a commit
to sodabrew/eventmachine
that referenced
this pull request
Apr 28, 2018
… must be prevented
sodabrew
added a commit
to sodabrew/eventmachine
that referenced
this pull request
Apr 28, 2018
The unbind callback absolutely must not raise an exception or the reactor will crash. If there is no EM.error_handler, or if the error_handler retrows, then stop the reactor, stash the exception in $wrapped_exception, and the exception will be raised after the reactor is cleaned up (see the last line of self.run). This fixes many crash reports in the 1.2 series since eventmachine#327 was merged.
sodabrew
added a commit
to sodabrew/eventmachine
that referenced
this pull request
Apr 30, 2018
… must be prevented
sodabrew
added a commit
to sodabrew/eventmachine
that referenced
this pull request
Apr 30, 2018
The unbind callback absolutely must not raise an exception or the reactor will crash. If there is no EM.error_handler, or if the error_handler retrows, then stop the reactor, stash the exception in $wrapped_exception, and the exception will be raised after the reactor is cleaned up (see the last line of self.run). This fixes many crash reports in the 1.2 series since eventmachine#327 was merged.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, eventmachine will stop when a handler raises an exception in its unbind method. This is an intended feature for when the eventmachine reactor is being stopped, as it is undesirable to keep the reactor running when exceptions are being thrown while connections are being unbound.
This however does cause issues when exceptions are raised in unbinds when eventmachine is not being stopped.
This fix adds a method to the eventmachine cpp module which enables you to check wether or not the reactor is being stopped. Consequently the raising of an exception during an unbind will only resort in a reactor stop if it was already being stopped.
We implemented this locally for a project, tested it and it seems to be working well. Granted, this is only necessary if handler code implements exceptions in the unbind method.
Tests have been added, and the existing ones all still pass.