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

ServerSocketChannel.bind(address) throw exception "java.net.SocketException: Operation not supported on transport endpoint" intermittently on solaris

XMLWordPrintable

      This issue is exposed by JDK-8169363.
      The issue should be a production issue or system issue on Solaris.
      The issue was reproduced on Oracle.Solaris.11.2.X86:

      The java code to reproduce the issue is:


      public class ServerSocketChannelTestInfinite {
          
          static private ServerSocketChannel channel;
          
          public static void main(String args[]) throws Exception {

              for (int i = 0; i < 100000; i++) {
                  // Create and bind a new server socket channel
                  channel = ServerSocketChannel.open();
          
                  // Enable SO_REUSEADDR before binding
                  channel.setOption(SO_REUSEADDR, true);
          
                  // Enable SO_REUSEPORT, if supported, before binding
                  if (channel.supportedOptions().contains(SO_REUSEPORT)) {
                      channel.setOption(SO_REUSEPORT, true);
                  }

                  try {
                      channel.bind(new InetSocketAddress(0));
                  } catch (Exception ex) {
                      System.err.println("loop, " + i);
                      throw ex;
                  }
                  Thread.sleep(3);
                  channel.close();
              }

          }
      }


      stack trace as below:
      $ java ServerSocketChannelTestInfinite
      loop, 8290
      Exception in thread "main" java.net.SocketException: Operation not supported on transport endpoint
              at java.base/sun.nio.ch.Net.listen(Native Method)
              at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:226)
              at java.base/java.nio.channels.ServerSocketChannel.bind(ServerSocketChannel.java:157)
              at ServerSocketChannelTestInfinite.main(ServerSocketChannelTestInfinite.java:39)

      loop, 1143
      Exception in thread "main" java.net.SocketException: Operation not supported on transport endpoint
              at java.base/sun.nio.ch.Net.listen(Native Method)
              at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:226)
              at java.base/java.nio.channels.ServerSocketChannel.bind(ServerSocketChannel.java:157)
              at ServerSocketChannelTestInfinite.main(ServerSocketChannelTestInfinite.java:39)


      loop, 14039
      Exception in thread "main" java.net.SocketException: Operation not supported on transport endpoint
              at java.base/sun.nio.ch.Net.listen(Native Method)
              at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:226)
              at java.base/java.nio.channels.ServerSocketChannel.bind(ServerSocketChannel.java:157)
              at ServerSocketChannelTestInfinite.main(ServerSocketChannelTestInfinite.java:39)

        1. netstat.log.s.1
          10 kB
          Hamlin Li
        2. netstat.log.s.2
          10 kB
          Hamlin Li
        3. netstat.log.s.3
          10 kB
          Hamlin Li
        4. netstat.log.s.after.run
          9 kB
          Hamlin Li
        5. netstat.log.s.before.run
          9 kB
          Hamlin Li
        6. RestartCrashedService.jtr
          25 kB
          Xiaofeng Yang

            michaelm Michael McMahon
            mli Hamlin Li
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: