Skip to content

Commit 2ef87ec

Browse files
committed
Fix race in Thread.list
1 parent 7f59858 commit 2ef87ec

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/truffleruby/core/thread/ThreadManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,8 @@ private void doKillOtherThreads() {
626626

627627
@TruffleBoundary
628628
public Object[] getThreadList() {
629-
return runningRubyThreads.toArray(new Object[runningRubyThreads.size()]);
629+
// This must not pre-allocate an array, or it could contain null's.
630+
return runningRubyThreads.toArray();
630631
}
631632

632633
@TruffleBoundary

0 commit comments

Comments
 (0)