Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix connect concurrency, can cause connection nodes to close #6964

Closed
wants to merge 1 commit into
from
Commits on Jul 22, 2014
  1. Fix connect concurrency, can cause connection nodes to close

    kimchy committed Jul 22, 2014
    Looking at the connect code, if 2 threads at the same time try and connect to a node, and both enter sequentially the connectLock code block, the second one would try and put the connection in the map, and close the replaced channels, which will cause the existing connection to close as well (since it removes the node from the connectedNodes map)
    To fix this, simply make sure we properly check the existence of the connection within the connectionLock block, so there won't be concurrent connections going on.
    While doing this, also went over all the mutation code that handles disconnections, and made sure they are properly done only within a connection lock.
    closes #6964