RFR: 8278268 - (ch) InputStream returned by Channels.newInputStream should have fast path for FileChannel targets [v12]

Markus KARG duke at openjdk.java.net
Thu Dec 23 10:10:15 UTC 2021


On Wed, 22 Dec 2021 17:29:22 GMT, Lance Andersen <lancea at openjdk.org> wrote:

> As Alan mentioned we are seeing failures in approximately 3% of the runs on various windows boxes. It appears to be an issue with TransferTo.testStreamContents->TransferTo.checkTransferredContents and selectableChannelOutput() as it blocking. I have not been able to determine the cause.

Looking at the fact that selectableChannelOutput() utilizes Channels.newInputStream() it comes to my mind that [Trisha Gee reported](https://trishagee.com/2021/12/21/simple-network-connections-with-java-a-problem/) that Channels.newInputStream() produced an endless hanging of her apparently correct code, and it was gone once she replaced it by Channels.newReader(). While she reproduced that on a Mac, it might be the same cause even on Windows. Trisha currently is working on a reproducer, but she already detected that *her* endless hanging is definitively a thread waiting for the blocking lock. This sounds similar to what you wrote above. So maybe the problem is not inside of TransferTo, but inside of ChannelInputStream?

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

PR: https://git.openjdk.java.net/jdk/pull/6711


More information about the nio-dev mailing list