To reproduce, start two members using TCP/TCPPING within TCPPING.timeout of each other (using 127.0.0.1:7600 and 127.0.0.1:7650 below).
When the first instance establishes itself as the master, it kills the valid connection to the second instance.
After TCPPING.timeout, on the first instance:
TRACE [org.jgroups.protocols.pbcast.GMS] I (127.0.0.1:7600) am the first of the clients, will become coordinator
DEBUG [org.jgroups.protocols.pbcast.GMS][local_addr=127.0.0.1:7600] view is [127.0.0.1:7600|0][127.0.0.1:7600]
DEBUG [org.jgroups.protocols.FD_SOCK] VIEW_CHANGE received: [127.0.0.1:7600]
TRACE [org.jgroups.blocks.ConnectionTable] At 127.0.0.1:7600 destroying orphan to 127.0.0.1:7650
TRACE [org.jgroups.blocks.ConnectionTable] destroyed <127.0.0.1:7600 --> 127.0.0.1:47548> (0 secs old)
TRACE [org.jgroups.blocks.ConnectionTable] Excption while read blocked for data from peer
java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
at java.io.DataInputStream.readInt(DataInputStream.java:370)
at org.jgroups.blocks.BasicConnectionTable$Connection.run(BasicConnectionTable.java:659)
at java.lang.Thread.run(Thread.java:619)
TRACE [org.jgroups.blocks.ConnectionTable] ConnectionTable.Connection.Receiver terminated
The second instance:
TRACE [org.jgroups.protocols.pbcast.GMS] I (127.0.0.1:7650) am not the first of the clients, waiting for another client to become coordinator
TRACE [org.jgroups.protocols.TCPPING][FIND_INITIAL_MBRS] sending PING request to 127.0.0.1:7600
TRACE [org.jgroups.protocols.TCP] sending msg to 127.0.0.1:7600, src=127.0.0.1:7650, headers are TCPPING: [PING: type=GET_MBRS_REQ, arg=null], TCP: [channel_name=dennis]
TRACE [org.jgroups.protocols.TCP] dest=127.0.0.1:7600 (47 bytes)
TRACE [org.jgroups.blocks.ConnectionTable] destroyed <null socket>
TRACE [org.jgroups.blocks.ConnectionTable] removed 127.0.0.1:7600, connections are local_addr=127.0.0.1:7650
connections (0):
ERROR [org.jgroups.blocks.ConnectionTable] failed sending data to 127.0.0.1:7600: java.net.SocketException: Socket closed
To reproduce, start two members using TCP/TCPPING within TCPPING.timeout of each other (using 127.0.0.1:7600 and 127.0.0.1:7650 below).
When the first instance establishes itself as the master, it kills the valid connection to the second instance.
After TCPPING.timeout, on the first instance:
TRACE [org.jgroups.protocols.pbcast.GMS] I (127.0.0.1:7600) am the first of the clients, will become coordinator
DEBUG [org.jgroups.protocols.pbcast.GMS] [local_addr=127.0.0.1:7600] view is [127.0.0.1:7600|0] [127.0.0.1:7600]
DEBUG [org.jgroups.protocols.FD_SOCK] VIEW_CHANGE received: [127.0.0.1:7600]
TRACE [org.jgroups.blocks.ConnectionTable] At 127.0.0.1:7600 destroying orphan to 127.0.0.1:7650
TRACE [org.jgroups.blocks.ConnectionTable] destroyed <127.0.0.1:7600 --> 127.0.0.1:47548> (0 secs old)
TRACE [org.jgroups.blocks.ConnectionTable] Excption while read blocked for data from peer
java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
at java.io.DataInputStream.readInt(DataInputStream.java:370)
at org.jgroups.blocks.BasicConnectionTable$Connection.run(BasicConnectionTable.java:659)
at java.lang.Thread.run(Thread.java:619)
TRACE [org.jgroups.blocks.ConnectionTable] ConnectionTable.Connection.Receiver terminated
The second instance:
TRACE [org.jgroups.protocols.pbcast.GMS] I (127.0.0.1:7650) am not the first of the clients, waiting for another client to become coordinator
TRACE [org.jgroups.protocols.TCPPING] [FIND_INITIAL_MBRS] sending PING request to 127.0.0.1:7600
TRACE [org.jgroups.protocols.TCP] sending msg to 127.0.0.1:7600, src=127.0.0.1:7650, headers are TCPPING: [PING: type=GET_MBRS_REQ, arg=null] , TCP: [channel_name=dennis]
TRACE [org.jgroups.protocols.TCP] dest=127.0.0.1:7600 (47 bytes)
TRACE [org.jgroups.blocks.ConnectionTable] destroyed <null socket>
TRACE [org.jgroups.blocks.ConnectionTable] removed 127.0.0.1:7600, connections are local_addr=127.0.0.1:7650
connections (0):
ERROR [org.jgroups.blocks.ConnectionTable] failed sending data to 127.0.0.1:7600: java.net.SocketException: Socket closed
When a new view is received, BasicConnectionTable.retainAll kills all connections to servers not in that view.
This includes valid connections to members still in the process of connecting.