Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close Gossip comm server-side connection in defer
In the gossip comm layer, if the connection is a server-side one, and the conn.serviceConnection() method returns, the connection needs to terminate. The goroutines that service that connection are terminated by asking the connectionStore to close that connection. But, if a new connection has been created (i.e from the client-side) in the meantime before the connStore deletes the connection, the connStore would close the new connection instead of the old one, and the goroutines that serve the old connection would still be alive until the process is shut down. This is a possible goroutine leak. The simplest way to fix this, is to call conn.close() regardless, which is safe because if a connection is closed twice, one of the attempts to close it is aborted because we have a CAS to ensure only 1 successfull invocation of conn.close. Change-Id: I2b9f2378cf07a547dbf900bb75aa1b196e7093b3 Signed-off-by: Yacov Manevich <yacovm@il.ibm.com>
- Loading branch information