8334719: (se) Deferred close of SelectableChannel may result in a Selector doing the final close before concurrent I/O on channel has completed

Co-authored-by: Alan Bateman <alanb@openjdk.org>
Reviewed-by: alanb, dfuchs
This commit is contained in:
Jaikiran Pai 2024-06-27 04:38:32 +00:00
parent 6682305ee2
commit 9bb675f89d
7 changed files with 705 additions and 0 deletions

View file

@ -654,6 +654,9 @@ class ServerSocketChannelImpl
@Override
public void kill() {
// wait for any accept operation to complete before trying to close
acceptLock.lock();
acceptLock.unlock();
synchronized (stateLock) {
if (state == ST_CLOSING) {
tryFinishClose();