-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
False
-
-
False
-
-
To reproduce:
- Run 2 Chat instances
- Config is stock tcp.xml, with FD_SOCK2 removed and TCP.enable_suspect_events=true
- Kill the second instance
-> The first instance will not get a new view until FD_ALL3 kicks in ca 40s later
The cause is in TcpConnection:
@Override
public void close(boolean graceful) throws IOException {
if(graceful && !closed_gracefully)
closeGracefully();
doClose();
}
protected void closeGracefully() {
server.log.trace("%s: sending graceful close to %s", server.local_addr, peer_addr);
closed_gracefully=true;
try {
sock.shutdownInput();
out.writeInt(Connection.GRACEFUL_CLOSE);
out.flush();
sock.shutdownOutput();
}
catch(Throwable t) {
server.log.error("%s: failed sending graceful close to %s: %s", server.local_addr, peer_addr, t.getMessage());
}
}
Setting closed_gracefully to true causes the issue. The correct code should be:
@Override
public void close(boolean graceful) throws IOException {
if(graceful && !closed_gracefully && !isClosed())
closeGracefully();
doClose();
}
protected void closeGracefully() {
server.log.trace("%s: sending graceful close to %s", server.local_addr, peer_addr);
// closed_gracefully=true;
try {
sock.shutdownInput();
out.writeInt(Connection.GRACEFUL_CLOSE);
out.flush();
sock.shutdownOutput();
}
catch(Throwable t) {
server.log.error("%s: failed sending graceful close to %s: %s", server.local_addr, peer_addr, t.getMessage());
}
}
Check why this was not caught in the EnableSuspectEvent tests