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)