zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sy...@apache.org
Subject [zookeeper] branch branch-3.6 updated: ZOOKEEPER-3991: Refresh InetSocketAddress before binding quorum server socket
Date Mon, 16 Nov 2020 07:44:29 GMT
This is an automated email from the ASF dual-hosted git repository.

symat pushed a commit to branch branch-3.6
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.6 by this push:
     new 7655bb8  ZOOKEEPER-3991: Refresh InetSocketAddress before binding quorum server socket
7655bb8 is described below

commit 7655bb83990753c30f564dedba79cd545e442740
Author: Lander Visterin <lander.visterin@klarrio.com>
AuthorDate: Mon Nov 16 07:41:58 2020 +0000

    ZOOKEEPER-3991: Refresh InetSocketAddress before binding quorum server socket
    
    Setting `electionPortBindRetry` to 0 (as recommended by the documentation for the setup
we are using) results in this code being called in a loop.
    
    The desired behaviour is that in case of a bad DNS reply the server socket creation will
fail and keep retrying until the hostname resolves. The current behaviour is that it keeps
throwing unresolved address errors even though the DNS entry became correct.
    
    For more details and reproduction steps see the Jira issue at https://issues.apache.org/jira/browse/ZOOKEEPER-3991
    
    Please note that the contents of this PR are different from the patch I initially attached
to the issue.
    
    Author: Lander Visterin <lander.visterin@klarrio.com>
    
    Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mate Szalay-Beko <symat@apache.org>
    
    Closes #1524 from lvisterin/ZOOKEEPER-3991
    
    (cherry picked from commit 58e0a7741533ec3598c619c526208f8a90f5756c)
    Signed-off-by: Mate Szalay-Beko <symat@apache.org>
---
 .../main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java   | 1 +
 1 file changed, 1 insertion(+)

diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
index 7efa0de..fc6ed5f 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
@@ -1131,6 +1131,7 @@ public class QuorumCnxManager {
                 }
 
                 socket.setReuseAddress(true);
+                address = new InetSocketAddress(address.getHostString(), address.getPort());
                 socket.bind(address);
 
                 return socket;


Mime
View raw message