Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8246707

(sc) SocketChannel.read/write throws AsynchronousCloseException on closed channel

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11, 14
    • Fix Version/s: 16
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Introduced In Version:
      11
    • Resolved In Build:
      b11

      Description

      import java.net.SocketAddress;
      import java.nio.ByteBuffer;
      import java.nio.channels.ServerSocketChannel;
      import java.nio.channels.SocketChannel;

      public class NIOTest {
          public static void main(String[] args) throws Exception {
              ServerSocketChannel server = ServerSocketChannel.open();
              server.bind(null);
              SocketAddress saddr = server.getLocalAddress();
              SocketChannel client = SocketChannel.open(saddr);
              System.out.println(client);
              client.close();
              ByteBuffer buf = ByteBuffer.wrap("Hello world".getBytes());
              client.write(buf);
          }
      }

      throws AsynchronousCloseException instead of ChannelClosedException

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ccleary Conor Cleary
                Reporter:
                michaelm Michael McMahon
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: