java.net.SocketException: Address already in use (Listen failed) at java.net.PlainSocketImpl.socketListen(java.base@9-internal/Native Method) at java.net.AbstractPlainSocketImpl.listen(java.base@9-internal/AbstractPlainSocketImpl.java:449) at java.net.ServerSocket.bind(java.base@9-internal/ServerSocket.java:377) at java.net.ServerSocket.<init>(java.base@9-internal/ServerSocket.java:238) at java.net.ServerSocket.<init>(java.base@9-internal/ServerSocket.java:182) at javax.net.ssl.SSLServerSocket.<init>(java.base@9-internal/SSLServerSocket.java:136) at sun.security.ssl.SSLServerSocketImpl.<init>(java.base@9-internal/SSLServerSocketImpl.java:116) at sun.security.ssl.SSLServerSocketFactoryImpl.createServerSocket(java.base@9-internal/SSLServerSocketFactoryImpl.java:79)

JDK Bug System | Felix Yang | 3 months ago
  1. 0

    This has been observed once in Linux X64 open only target. Please refer to the test output: ----------System.out:(23/1161)---------- server #0 started on port 60343 server #1 started on port 61867 server #2 started on port 64926 client #0 connects to port 60343 client #1 connects to port 61867 client #2 connects to port 64926 Current cacheSize is set to: 0 Currently cached Sessions...... ======================================================================== Session Session-last-accessTime ======================================================================== [Session-7, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256] Tue Aug 30 22:11:27 PDT 2016 [Session-3, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256] Tue Aug 30 22:11:27 PDT 2016 [Session-5, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256] Tue Aug 30 22:11:27 PDT 2016 ------------------------------------------------------------------------ Session cache size changed to: 2 [Session-3, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256] Tue Aug 30 22:11:27 PDT 2016 [Session-5, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256] Tue Aug 30 22:11:27 PDT 2016 ------------------------------------------------------------------------ Session cache size changed to: 3 client #3 connects to port 0 ----------System.err:(48/3752)---------- Server died... java.net.SocketException: Address already in use (Listen failed) at java.net.PlainSocketImpl.socketListen(java.base@9-internal/Native Method) at java.net.AbstractPlainSocketImpl.listen(java.base@9-internal/AbstractPlainSocketImpl.java:449) at java.net.ServerSocket.bind(java.base@9-internal/ServerSocket.java:377) at java.net.ServerSocket.<init>(java.base@9-internal/ServerSocket.java:238) at java.net.ServerSocket.<init>(java.base@9-internal/ServerSocket.java:182) at javax.net.ssl.SSLServerSocket.<init>(java.base@9-internal/SSLServerSocket.java:136) at sun.security.ssl.SSLServerSocketImpl.<init>(java.base@9-internal/SSLServerSocketImpl.java:116) at sun.security.ssl.SSLServerSocketFactoryImpl.createServerSocket(java.base@9-internal/SSLServerSocketFactoryImpl.java:79) at SessionCacheSizeTests.doServerSide(SessionCacheSizeTests.java:113) at SessionCacheSizeTests$1.run(SessionCacheSizeTests.java:446) java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(java.base@9-internal/Native Method) at java.net.AbstractPlainSocketImpl.doConnect(java.base@9-internal/AbstractPlainSocketImpl.java:400) at java.net.AbstractPlainSocketImpl.connectToAddress(java.base@9-internal/AbstractPlainSocketImpl.java:243) at java.net.AbstractPlainSocketImpl.connect(java.base@9-internal/AbstractPlainSocketImpl.java:225) at java.net.SocksSocketImpl.connect(java.base@9-internal/SocksSocketImpl.java:402) at java.net.Socket.connect(java.base@9-internal/Socket.java:591) at sun.security.ssl.SSLSocketImpl.connect(java.base@9-internal/SSLSocketImpl.java:652) at sun.security.ssl.SSLSocketImpl.<init>(java.base@9-internal/SSLSocketImpl.java:417) at sun.security.ssl.SSLSocketFactoryImpl.createSocket(java.base@9-internal/SSLSocketFactoryImpl.java:88) at SessionCacheSizeTests.doClientSide(SessionCacheSizeTests.java:226) at SessionCacheSizeTests.startClient(SessionCacheSizeTests.java:491) at SessionCacheSizeTests.<init>(SessionCacheSizeTests.java:368) at SessionCacheSizeTests.main(SessionCacheSizeTests.java:332) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-internal/Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@9-internal/NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-internal/DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(java.base@9-internal/Method.java:535) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:110) at java.lang.Thread.run(java.base@9-internal/Thread.java:843) Caused by: java.net.SocketException: Address already in use (Listen failed) at java.net.PlainSocketImpl.socketListen(java.base@9-internal/Native Method) at java.net.AbstractPlainSocketImpl.listen(java.base@9-internal/AbstractPlainSocketImpl.java:449) at java.net.ServerSocket.bind(java.base@9-internal/ServerSocket.java:377) at java.net.ServerSocket.<init>(java.base@9-internal/ServerSocket.java:238) at java.net.ServerSocket.<init>(java.base@9-internal/ServerSocket.java:182) at javax.net.ssl.SSLServerSocket.<init>(java.base@9-internal/SSLServerSocket.java:136) at sun.security.ssl.SSLServerSocketImpl.<init>(java.base@9-internal/SSLServerSocketImpl.java:116) at sun.security.ssl.SSLServerSocketFactoryImpl.createServerSocket(java.base@9-internal/SSLServerSocketFactoryImpl.java:79) at SessionCacheSizeTests.doServerSide(SessionCacheSizeTests.java:113) at SessionCacheSizeTests$1.run(SessionCacheSizeTests.java:446)

    JDK Bug System | 3 months ago | Felix Yang
    java.net.SocketException: Address already in use (Listen failed) at java.net.PlainSocketImpl.socketListen(java.base@9-internal/Native Method) at java.net.AbstractPlainSocketImpl.listen(java.base@9-internal/AbstractPlainSocketImpl.java:449) at java.net.ServerSocket.bind(java.base@9-internal/ServerSocket.java:377) at java.net.ServerSocket.<init>(java.base@9-internal/ServerSocket.java:238) at java.net.ServerSocket.<init>(java.base@9-internal/ServerSocket.java:182) at javax.net.ssl.SSLServerSocket.<init>(java.base@9-internal/SSLServerSocket.java:136) at sun.security.ssl.SSLServerSocketImpl.<init>(java.base@9-internal/SSLServerSocketImpl.java:116) at sun.security.ssl.SSLServerSocketFactoryImpl.createServerSocket(java.base@9-internal/SSLServerSocketFactoryImpl.java:79)
  2. 0

    In some occasions, the information given by a SocketException could contain some more detail to ease troubleshooting and spot the source code location where it happened. For instance, a little testcase where I constructed a problem would throw an exception like this: java.net.SocketException: Bad file number at java.net.NetworkInterface.getAll(java.base@9-internal/Native Method) at java.net.NetworkInterface.getNetworkInterfaces(java.base@9-internal/NetworkInterface.java:343) at com.sap.cl.NetworkInterfaceList8.printInterfaces(NetworkInterfaceList8.java:18) at com.sap.cl.NetworkInterfaceList8.main(NetworkInterfaceList8.java:105) However, native method java.net.NetworkInterface.getAll dives into several other methods and there are quite a few places where socket exceptions could happen. The information should be extended to something like this: java.net.SocketException: ioctl SIOCGSIZIFCONF failed: Bad file number at java.net.NetworkInterface.getAll(java.base@9-internal/Native Method) at java.net.NetworkInterface.getNetworkInterfaces(java.base@9-internal/NetworkInterface.java:343) at com.sap.cl.NetworkInterfaceList8.printInterfaces(NetworkInterfaceList8.java:18) at com.sap.cl.NetworkInterfaceList8.main(NetworkInterfaceList8.java:105)

    JDK Bug System | 7 months ago | Christoph Langer
    java.net.SocketException: Bad file number at java.net.NetworkInterface.getAll(java.base@9-internal/Native Method) at java.net.NetworkInterface.getNetworkInterfaces(java.base@9-internal/NetworkInterface.java:343)
  3. 0

    In some occasions, the information given by a SocketException could contain some more detail to ease troubleshooting and spot the source code location where it happened. For instance, a little testcase where I constructed a problem would throw an exception like this: java.net.SocketException: Bad file number at java.net.NetworkInterface.getAll(java.base@9-internal/Native Method) at java.net.NetworkInterface.getNetworkInterfaces(java.base@9-internal/NetworkInterface.java:343) at com.sap.cl.NetworkInterfaceList8.printInterfaces(NetworkInterfaceList8.java:18) at com.sap.cl.NetworkInterfaceList8.main(NetworkInterfaceList8.java:105) However, native method java.net.NetworkInterface.getAll dives into several other methods and there are quite a few places where socket exceptions could happen. The information should be extended to something like this: java.net.SocketException: ioctl SIOCGSIZIFCONF failed: Bad file number at java.net.NetworkInterface.getAll(java.base@9-internal/Native Method) at java.net.NetworkInterface.getNetworkInterfaces(java.base@9-internal/NetworkInterface.java:343) at com.sap.cl.NetworkInterfaceList8.printInterfaces(NetworkInterfaceList8.java:18) at com.sap.cl.NetworkInterfaceList8.main(NetworkInterfaceList8.java:105)

    JDK Bug System | 7 months ago | Christoph Langer
    java.net.SocketException: ioctl SIOCGSIZIFCONF failed: Bad file number at java.net.NetworkInterface.getAll(java.base@9-internal/Native Method) at java.net.NetworkInterface.getNetworkInterfaces(java.base@9-internal/NetworkInterface.java:343)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Server socket getting an error permission denied exception android

    Stack Overflow | 2 years ago
    java.net.SocketException: socket failed: EACCES (Permission denied) 04-10 20:17:00.179 11984-12213/com.example.hassan.chat W/System.err﹕ at libcore.io.IoBridge.socket(IoBridge.java:623) 04-10 20:17:00.179 11984-12213/com.example.hassan.chat W/System.err﹕ at java.net.PlainSocketImpl.create(PlainSocketImpl.java:198) 04-10 20:17:00.179 11984-12213/com.example.hassan.chat W/System.err﹕ at java.net.PlainServerSocketImpl.create(PlainServerSocketImpl.java:38) 04-10 20:17:00.179 11984-12213/com.example.hassan.chat W/System.err﹕ at java.net.ServerSocket.<init>(ServerSocket.java:103) 04-10 20:17:00.179 11984-12213/com.example.hassan.chat W/System.err﹕ at java.net.ServerSocket.<init>(ServerSocket.java:74)
  6. 0

    java.net.SocketException: socket closed

    apache.org | 9 months ago
    java.net.SocketException: socket closedjava.net.SocketException: socket closed at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) at java.net.ServerSocket.implAccept(ServerSocket.java:450) at java.net.ServerSocket.accept(ServerSocket.java:421)

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.net.SocketException

      Address already in use (Listen failed) at java.net.PlainSocketImpl.socketListen(java.base@9-internal/Native Method) at java.net.AbstractPlainSocketImpl.listen(java.base@9-internal/AbstractPlainSocketImpl.java:449) at java.net.ServerSocket.bind(java.base@9-internal/ServerSocket.java:377) at java.net.ServerSocket.<init>(java.base@9-internal/ServerSocket.java:238) at java.net.ServerSocket.<init>(java.base@9-internal/ServerSocket.java:182) at javax.net.ssl.SSLServerSocket.<init>(java.base@9-internal/SSLServerSocket.java:136) at sun.security.ssl.SSLServerSocketImpl.<init>(java.base@9-internal/SSLServerSocketImpl.java:116) at sun.security.ssl.SSLServerSocketFactoryImpl.createServerSocket(java.base@9-internal/SSLServerSocketFactoryImpl.java:79)

      at SessionCacheSizeTests.doServerSide()
    2. Unknown
      SessionCacheSizeTests$1.run
      1. SessionCacheSizeTests.doServerSide(SessionCacheSizeTests.java:113)
      2. SessionCacheSizeTests$1.run(SessionCacheSizeTests.java:446)
      2 frames