Behaviour of SocketChannelImpl.close() in Java11 (ea+12)

Norman Maurer norman.maurer at googlemail.com
Fri May 11 18:13:08 UTC 2018


Sorry I just noticed this would better be asked on nio.dev. Will ask there.

Bye
Norman


> On 11. May 2018, at 20:10, Norman Maurer <norman.maurer at googlemail.com> wrote:
> 
> Hi all,
> 
> I recently started to test Netty [1] with Java11 and found that we have two tests that are currently failing due some changes in Java 11 compared to earlier versions.
> 
> I wanted to get your thoughts on the behaviour changes:
> 
> 1) SocketChannelImpl.close() will trigger shutdown(…,SHUT_WR) if the channel is connected before do the actual close(…).
> 
> This is different to earlier version where it was just closed via close(…). We noticed this because we have a unit test that basically set SO_LINGER 0 and verifies that the remote peer sees a ECONNRESET when channel is closed. This is not the case here anymore as the shutdown will cause an EOF. 
> I wonder depending on the connection reset is just plain wrong from our side as its an implementation detail, but at least it was super surprising to me that a shutdown(…) was called during the close operation. Especially as shutdownOutput() is exposed directly as well.
> 
> 
> 2) SocketChannelImpl.close() will not directly close the fd but add it to a queue that will be processed by the Selector.
> 
> Again this is different to earlier versions and had the effect that one test failed that expected that the fd is really closed when close() returns. 
> 
> 
> I worked around these differences via [2] but I wanted to ask if this is expected.
> 
> 
> Java version:
> 
> java version "11-ea" 2018-09-25
> Java(TM) SE Runtime Environment 18.9 (build 11-ea+12)
> Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11-ea+12, mixed mode)
> 
> 
> [1] http://netty.io <http://netty.io/>
> [2] https://github.com/netty/netty/pull/7926 <https://github.com/netty/netty/pull/7926>
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/net-dev/attachments/20180511/80a6708b/attachment.html>


More information about the net-dev mailing list