A non-blocking socket operation could not be completed immediately

Simone Bordet simone.bordet at
Wed Jun 6 12:04:29 UTC 2018


On Wed, Jun 6, 2018 at 11:33 AM, Alan Bateman <Alan.Bateman at> wrote:
> Moving this mail to nio-dev.
> Simone - one thing to point out is that the SO_LINGER option is only
> specified for sockets that are configured blocking. Here's the relevant
> paragraph from the StandardSocketOption#SO_LINGER javadoc
> "This socket option is intended for use with sockets that are configured in
> blocking mode only. The behavior of the close method when this option is
> enabled on a non-blocking socket is not defined."

Ah, thanks for this pointer.

> The implementation has changed in JDK 11 so that SocketChannel close
> disables SO_LINGER when it's enabled with a value other than 0 and the
> channel is registered with a Selector. The eventual close will happen when
> the channel is flushed from the Selector (the stack trace in your bug
> report) but it won't hit this issue because SO_LINGER will be disabled.

Thanks for sharing the behavior change in JDK 11.

Simone Bordet
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz

More information about the nio-dev mailing list