Problem with half-closure related to connection-reset in Java 11
Alan Bateman
Alan.Bateman at oracle.com
Tue May 29 14:19:31 UTC 2018
On 29/05/2018 14:52, Norman Maurer wrote:
> 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
> 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,
Reading beyond connection reset has always been problematic and never
guaranteed to work, esp. on the main stream platforms. I think you are
arguing that hitting connection reset when writing shouldn't impact
another thread reading. That probably make sense although it's hard to
relate to something that depends on such behavior. Can you submit a bug
to track this so that we at least track the behavior change?
-Alan
More information about the net-dev
mailing list