[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-net-dev
Subject:    Integrated: 8278339: ServerSocket::isClosed may return false after accept throws
From:       Alan Bateman <alanb () openjdk ! java ! net>
Date:       2021-12-07 14:26:26
Message-ID: 1iP7aiw1IJ8d-41B3OMaaMy9bC286edgzmct6bdR3GQ=.4220a701-0a03-4466-bf96-93a742b71c62 () github ! com
[Download RAW message or body]

On Tue, 7 Dec 2021 12:29:09 GMT, Alan Bateman <alanb@openjdk.org> wrote:

> JDK-8278270 introduces a small regression. If a ServerSocket is closed while \
> another thread is blocked in the accept method then the other thread may observe \
> isClosed returning false, i.e. code may catch IOException and check isClosed before \
> the "closed" flag gets to true. 
> I've changed the close method to set the "closed" flag before closing the \
> underlying impl. This is consistent with the network channels and also consistent \
> with async close where the close completes on the thread that was blocked in \
> accept. The change also prevents re-attempting the underlying impl in the unlikely \
> event that it fails(an area that is completed unspecified). Overall I think this is \
> preferable to have add synchronization to isClosed.

This pull request has now been integrated.

Changeset: 69d8669f
Author:    Alan Bateman <alanb@openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/69d8669fb3f1e4db2fbb3366a1349dd0285f5b0f
                
Stats:     93 lines in 2 files changed: 85 ins; 7 del; 1 mod

8278339: ServerSocket::isClosed may return false after accept throws

Reviewed-by: dfuchs

-------------

PR: https://git.openjdk.java.net/jdk/pull/6741


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic