Found different in behavior of SocketInputStream#read in JDK13
Alan Bateman
Alan.Bateman at oracle.com
Thu Aug 1 14:01:24 UTC 2019
On 01/08/2019 02:47, Enrico Olivelli wrote:
> :
>
> Just to be clear. What is the plan now ? to leave JDK13 as it is
> currently or to change the behavior ?
> If I understand correctly Alan's answer means that the new behavior in
> JDK13 is now consistent across Windows, Linux and Mac and we want to
> keep it
> so it is better to adapt application code.
The test that Chris created to demonstrate zookeeper scenario is great
as it makes it clear that the issue is closing the socket with bytes in
the receive queue [1]. The JDK's behavior in this scenario has always
been platform specific. On Windows, with java.net.Socket, the JDK has
always shutdown the connection (when linger is not enabled). On other
platforms it didn't do the shutdown. There are several subtle
differences in the Windows TCP implemetation that means we can never
change this without breaking many deployments (and dozens of JDK tests
too). To add more complexity, NIO SocketChannel has to allow for closing
when the channel is registered with a Selector and that will determine
whether the connection is shutdown before the final close. So I think
your updated zookeeper test is correct as it caters for the different
possible behaviors that have always been possible.
I don't know yet if we are going to attempt to do anything for JDK 13.
JDK 13 is in rampdown phase two and there is an workaround via a system
property to bring back the old behavior. If we do fix it then I think
the only feasible solution is to limit the shutdown to Windows as
before. So we'll reply back soon on this.
-Alan
[1] http://cs.baylor.edu/~donahoo/practical/CSockets/TCPRST.pdf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190801/64125def/attachment.html>
More information about the nio-dev
mailing list