File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/main/java/org/truffleruby/core/thread Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -189,11 +189,14 @@ private static Thread.UncaughtExceptionHandler uncaughtExceptionHandler(RubyFibe
189
189
return (javaThread , throwable ) -> {
190
190
printInternalError (throwable );
191
191
try {
192
+ fiber .uncaughtException = throwable ;
193
+
194
+ // If an uncaught exception happens, we already left the context, so it is safe to let other Fibers run
195
+
192
196
// the Fiber is not yet initialized, unblock the caller and rethrow the exception to it
193
- if (fiber .initializedLatch .getCount () > 0 ) {
194
- fiber .uncaughtException = throwable ;
195
- fiber .initializedLatch .countDown ();
196
- }
197
+ fiber .initializedLatch .countDown ();
198
+ // the Fiber thread is dying, unblock the caller
199
+ fiber .finishedLatch .countDown ();
197
200
} catch (Throwable t ) { // exception inside this UncaughtExceptionHandler
198
201
t .initCause (throwable );
199
202
printInternalError (t );
You can’t perform that action at this time.
0 commit comments