RFR: 8374170: I/O Poller updates

Alan Bateman alanb at openjdk.org
Thu Feb 5 14:34:37 UTC 2026


On Thu, 5 Feb 2026 13:05:44 GMT, Michael McMahon <michaelm at openjdk.org> wrote:

>> The I/O Poller used to support virtual threads doing blocking networking I/O has been significantly refactored in the loom repo. There are several improvements that should be brought to main line:
>> 
>> 1. New poller mode that uses a read poller per carrier, this is beneficial in some workloads.
>> 2. Better cleanup/recovery in the event if a file descriptor or memory can't be allocated during initializatio.
>> 3. NativeThread changed to cache native thread ID and avoid JNI call to current0 for each blocking I/O op.
>> 
>> The changes have been in the loom repo for a long time, this is why the copyright header is updated to 2025 (not 2026) in some cases.
>> 
>> Testing: tier1 + tier2.
>
> src/java.base/share/classes/sun/nio/ch/NativeDispatcher.java line 88:
> 
>> 86:         }
>> 87:         // dup2 and signal platform threads
>> 88:         implPreClose(fd, reader, writer);
> 
> Can you explain why implPreClose() is called here always, where previously it was only called when reader or writer were platform threads?

implPreClose does signals the reader and/or writer if they are platform threads. It doesn't do any signal if they are both null. So on that front it doesn't matter if it is called or not when they are both null.

There is one small advantage to not calling it when they are both null in that it avoids a needless dup2. So I think that would be better. Thanks for bringing it up.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/29195#discussion_r2769483019


More information about the net-dev mailing list