8201474: (so) Socket adaptor connect(InetAddress, timeout) succeeds when connection fails

Alan Bateman Alan.Bateman at oracle.com
Mon Apr 16 11:26:00 UTC 2018


On 16/04/2018 12:02, Hamlin Li wrote:
> Hi Alan,
>
> Sorry for the delayed comments, I did not have chance to check the 
> changes.
>
> I think the fix is good, it should work, but I think we can do better.
>
> The root cause of 8201474 is that in pollXXX(e.g. pollConnected in 
> SocketChannelImpl.java) only check whether return result of 
> Net.poll(...) > 0, it does not check whether it is/includes POLLERR, 
> POLLHUP, POLLNVAL.
No, the root cause is was that pollConnected changed the channel state 
to ST_CONNECTED. We don't want the pollXXX methods changing the channel 
state. It only came about because they are re-using the beginXXX/endXXX 
methods to wrap the blocking poll. It might be clearer if we just 
inlined those.

-Alan


More information about the nio-dev mailing list