Skip to content

Commit 66ce8e4

Browse files
committed
Fix issue with a safepoint happening before language.getCurrentThread() is set in non-root Fibers
* Unfortunately this cannot fix the case of using --fiber-leave-context=false.
1 parent 0ea6930 commit 66ce8e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/truffleruby/language/SafepointAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ protected final void perform(Access access) {
5757
Thread.currentThread());
5858
}
5959

60-
final RubyLanguage language = RubyLanguage.getCurrentLanguage();
6160
final RubyContext context = RubyLanguage.getCurrentContext();
62-
final RubyThread rubyThread = language.getCurrentThread();
61+
// Not using language.getCurrentThread() here because it might not be set yet, see fiberMain()
62+
final RubyThread rubyThread = context.getThreadManager().getRubyThreadForJavaThread(access.getThread());
6363
if (filter.test(context, rubyThread, this)) {
6464
run(rubyThread, access.getLocation());
6565
}

0 commit comments

Comments
 (0)