Skip to content

Commit

Permalink
UnicastZenPing's PingingRound should prevent opening connections afte…
Browse files Browse the repository at this point in the history
…r being closed

This may cause them to leak. Provisioning for it was made in #22277 but sadly a crucial ensureOpen call was forgotten
  • Loading branch information
bleskes committed Dec 23, 2016
1 parent 21bd58f commit be74fc2
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,14 @@ public Connection getOrConnect(DiscoveryNode node) throws IOException {
try (Releasable ignore = connectionLock.acquire(node.getAddress())) {
result = tempConnections.get(node.getAddress());
if (result == null) {
ensureOpen();
boolean success = false;
result = transportService.openConnection(node, connectionProfile);
try {
transportService.handshake(result, connectionProfile.getHandshakeTimeout().millis());
synchronized (this) {
// acquire lock to prevent concurrent closing
// acquire lock and check if closed, to prevent leaving an open connection after closing
ensureOpen();
Connection existing = tempConnections.put(node.getAddress(), result);
assert existing == null;
success = true;
Expand Down

0 comments on commit be74fc2

Please sign in to comment.