Problem with half-closure related to connection-reset in Java 11
Norman Maurer
norman.maurer at googlemail.com
Tue May 29 13:52:37 UTC 2018
Hi all,
After trying to run our testsuite in Netty [1] with Java11+ea15 I noticed we have one failing test that seems to be related to:
https://bugs.openjdk.java.net/browse/JDK-8199329 <https://bugs.openjdk.java.net/browse/JDK-8199329>
http://hg.openjdk.java.net/jdk/jdk/rev/92cca24c8807 <http://hg.openjdk.java.net/jdk/jdk/rev/92cca24c8807>
I think the change here is not 100 % correct as it basically disallow draining any remaining bytes from the socket if a write causes a connection reset. This should be completely safe to do. At the moment if a write is causing a connection-reset you basically loose all the pending bytes that are sitting on the socket and are waiting to be read.
This happens because SocketOutputStream.write(…) may call AbstractPlainSocketImpl.setConnectionReset(…). Once this method is called any read(…) call will just throw a SocketException without even attempt to read any remaining data.
This was not the case with earlier Java versions, and I would argue its a bug.
Let me know what you think and please ask if you have any more questions,
Norman
[1] https://github.com/netty/netty/blob/4.1/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketHalfClosedTest.java#L385 <https://github.com/netty/netty/blob/4.1/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketHalfClosedTest.java#L385>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/net-dev/attachments/20180529/4217e487/attachment.html>
More information about the net-dev
mailing list