Skip to content

Commit

Permalink
Do not capture or propagate to main any Unrescuable exceptions.
Browse files Browse the repository at this point in the history
Unrescuable exceptions in JRuby are used for internal operations,
usually involving the termination of a thread or of the running
program. They should not be captured as the terminal state of a
Ruby thread, nor should they be propagated across threads. This
was causing CI to terminate (with a success return code) on 9.1
and master.
headius committed Apr 16, 2018
1 parent 9549f5d commit 7464f3a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/main/java/org/jruby/RubyThread.java
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@
import org.jruby.anno.JRubyMethod;
import org.jruby.exceptions.RaiseException;
import org.jruby.exceptions.ThreadKill;
import org.jruby.exceptions.Unrescuable;
import org.jruby.internal.runtime.NativeThread;
import org.jruby.internal.runtime.RubyRunnable;
import org.jruby.internal.runtime.ThreadLike;
@@ -1638,6 +1639,11 @@ public void exceptionRaised(RaiseException exception) {
* @param throwable
*/
public void exceptionRaised(Throwable throwable) {
// if unrescuable (internal exceptions) just re-raise and let it be handled by thread handler
if (throwable instanceof Unrescuable) {
Helpers.throwException(throwable);
}

Ruby runtime = getRuntime();

assert isCurrent();

0 comments on commit 7464f3a

Please sign in to comment.