-
Bug
-
Resolution: Not a Bug
-
Minor
-
None
-
None
-
False
-
None
-
False
This is a weird issue that shows up in Infinispan testsuite and causes failure (not sure if it can happen in production, that's why I reduced the priority to minor).
The tests use the same JGroups with bind_port=7200 and port_range=30. Sometimes, the tests fail to bind to a port although there are enough ports available.
I did some debugging in method org.jgroups.util.Util#bind(java.net.ServerSocket, java.net.InetAddress, int, int), and I found the following:
If I get the following exception, everything works as expected and the test is able to bind to the next port
java.net.BindException: Address already in use (Bind failed) at java.net.PlainSocketImpl.socketBind(Native Method) ~[?:?] at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:436) ~[?:?] at java.net.ServerSocket.bind(ServerSocket.java:395) ~[?:?] at java.net.ServerSocket.bind(ServerSocket.java:349) ~[?:?] at org.jgroups.util.Util.bind(Util.java:4038) ~[jgroups-5.2.3.Final-SNAPSHOT.jar:5.2.3.Final-SNAPSHOT] at org.jgroups.util.Util.createServerSocket(Util.java:4018) ~[jgroups-5.2.3.Final-SNAPSHOT.jar:5.2.3.Final-SNAPSHOT] at org.jgroups.blocks.cs.TcpServer.<init>(TcpServer.java:64) ~[jgroups-5.2.3.Final-SNAPSHOT.jar:5.2.3.Final-SNAPSHOT] at org.jgroups.protocols.TCP.start(TCP.java:101) ~[jgroups-5.2.3.Final-SNAPSHOT.jar:5.2.3.Final-SNAPSHOT]
However, if this exception happens (note that it says Listen failed):
java.net.SocketException: Address already in use (Listen failed) at java.net.PlainSocketImpl.socketListen(Native Method) ~[?:?] at java.net.AbstractPlainSocketImpl.listen(AbstractPlainSocketImpl.java:448) ~[?:?] at java.net.ServerSocket.bind(ServerSocket.java:396) ~[?:?] at java.net.ServerSocket.bind(ServerSocket.java:349) ~[?:?] at org.jgroups.util.Util.bind(Util.java:4038) ~[jgroups-5.2.3.Final-SNAPSHOT.jar:5.2.3.Final-SNAPSHOT] at org.jgroups.util.Util.createServerSocket(Util.java:4018) ~[jgroups-5.2.3.Final-SNAPSHOT.jar:5.2.3.Final-SNAPSHOT] at org.jgroups.blocks.cs.TcpServer.<init>(TcpServer.java:64) ~[jgroups-5.2.3.Final-SNAPSHOT.jar:5.2.3.Final-SNAPSHOT]
all the remaining attempts failed with
{Invalid argument (Bind failed)}java.net.SocketException: Invalid argument (Bind failed) at java.net.PlainSocketImpl.socketBind(Native Method) ~[?:?] at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:436) ~[?:?] at java.net.ServerSocket.bind(ServerSocket.java:395) ~[?:?] at java.net.ServerSocket.bind(ServerSocket.java:349) ~[?:?] at org.jgroups.util.Util.bind(Util.java:4038) ~[jgroups-5.2.3.Final-SNAPSHOT.jar:5.2.3.Final-SNAPSHOT] at org.jgroups.util.Util.createServerSocket(Util.java:4018) ~[jgroups-5.2.3.Final-SNAPSHOT.jar:5.2.3.Final-SNAPSHOT] at org.jgroups.blocks.cs.TcpServer.<init>(TcpServer.java:64) ~[jgroups-5.2.3.Final-SNAPSHOT.jar:5.2.3.Final-SNAPSHOT] at org.jgroups.protocols.TCP.start(TCP.java:101) ~[jgroups-5.2.3.Final-SNAPSHOT.jar:5.2.3.Final-SNAPSHOT]
- relates to
-
ISPN-13965 Set bind_port=0 for cross-site tests
- Closed