Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make the IO fd field volatile
The accessors read it outside the lock while close writes it under the lock,
so without this the close is not guaranteed visible and the ChannelFD handed
out is not safely published.
  • Loading branch information
aminmansuri committed Sep 19, 2026
commit fa351a957823e3e4eba4c7b7605b48f410ef3fa3
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/util/io/OpenFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ public static interface Finalizer {
public void finalize(Ruby runtime, OpenFile fptr, boolean noraise);
}

private ChannelFD fd;
// volatile so a close in another thread is visible to the accessors below, which read fd
// outside the lock, and so the ChannelFD they hand out is safely published.
private volatile ChannelFD fd;
private int mode;
private long pid = -1;
private Process process;
Expand Down