RFR: 8305744: (ch) InputStream returned by Channels.newInputStream should have fast path for ReadbleByteChannel/WritableByteChannel [v3]
Markus KARG
duke at openjdk.org
Sat Apr 15 12:31:33 UTC 2023
On Sat, 8 Apr 2023 06:40:39 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Markus KARG has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Putting the special casing for an output stream backed by a ChannelOutputStream in one place.
>
> src/java.base/share/classes/sun/nio/ch/ChannelInputStream.java line 281:
>
>> 279: if (!wsc.isBlocking())
>> 280: throw new IllegalBlockingModeException();
>> 281: return transfer(rbc, wbc);
>
> This introduces the potential for deadlock as lock ordering is not specified for the transferXXX methods. Note that this same issue is problematic for some of the optimisations at the lower level in FileChannel too. We'll need to think about this topic.
IIUC the JRE already has the same problem in *other* locations, so wouldn't it make sense to merge the current PR as-is (to gain its benefit already in the upcoming LTS release) and postpone the discussion about possible deadlocks into a separate PR which then covers *all* those existing problematic code locations as a whole? Because I do not see why to withhold *just this* PR due to a problem existing *already* in the JRE.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13387#discussion_r1167488127
More information about the nio-dev
mailing list