Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZOOKEEPER-4728: force to re-resolve hostname into IP when binding. #2040

Merged
merged 2 commits into from
Aug 29, 2023

Conversation

showuon
Copy link
Contributor

@showuon showuon commented Jul 27, 2023

When the leader tried to bind the host/IP to get connection from followers, if the DNS is not ready at first, it'll always stay in <unresolved> state forever. This PR tries to resolve hostname into IP each time we tried to bind.

Note: The same solution we also applied in QuorumCnxManager (i.e. #1524)

address = new InetSocketAddress(address.getHostString(), address.getPort());

@sonatype-lift
Copy link

sonatype-lift bot commented Jul 27, 2023

Sonatype Lift is retiring

Sonatype Lift will be retiring on Sep 12, 2023, with its analysis stopping on Aug 12, 2023. We understand that this news may come as a disappointment, and Sonatype is committed to helping you transition off it seamlessly. If you’d like to retain your data, please export your issues from the web console.
We are extremely grateful and thank you for your support over the years.

📖 Read about the impacts and timeline

@showuon showuon changed the title ZOOKEEPER-4708: force to re-resolve hostname into IP when binding. ZOOKEEPER-4728: force to re-resolve hostname into IP when binding. Jul 27, 2023
@showuon
Copy link
Contributor Author

showuon commented Jul 28, 2023

@symat @eolivelli , call for review. Thanks.

@anmolnar
Copy link
Contributor

anmolnar commented Aug 4, 2023

Nice catch @showuon . Would you please try adding a unit test to cover the issue?

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@showuon
Copy link
Contributor Author

showuon commented Aug 5, 2023

Nice catch @showuon . Would you please try adding a unit test to cover the issue?

Tests added. Thanks.

@@ -318,7 +322,7 @@ Optional<ServerSocket> createServerSocket(InetSocketAddress address, boolean por
serverSocket = new ServerSocket();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UNENCRYPTED_SERVER_SOCKET: Unencrypted server socket (instead of SSLServerSocket)


ℹ️ Expand to see all @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still great

+1

@showuon
Copy link
Contributor Author

showuon commented Aug 28, 2023

@anmolnar , please take a look when available. Thanks.

Copy link
Contributor

@anmolnar anmolnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

@anmolnar anmolnar merged commit 40aed41 into apache:master Aug 29, 2023
12 checks passed
@anmolnar
Copy link
Contributor

@showuon I submitted this to the master branch which means it will be released in 3.10.0. If you would like to see this in earlier releases, please let me know and I can backport it for you.

Also the Jira is not assigned to you, do you already have contributor rights for ZooKeeper jira project?

@showuon
Copy link
Contributor Author

showuon commented Aug 29, 2023

If you would like to see this in earlier releases, please let me know and I can backport it for you.

Yes, I'd like to backport to 3.8 and 3.9 release. Thanks.

do you already have contributor rights for ZooKeeper jira project?

No, I don't have the contributor rights for ZooKeeper jira project. My JIRA ID: showuon. Thanks.

rahulrane50 pushed a commit to rahulrane50/zookeeper that referenced this pull request Sep 15, 2023
…pache#2040)

* ZOOKEEPER-4728: force to re-resolve hostname into IP when binding

* ZOOKEEPER-4708: add test
@showuon
Copy link
Contributor Author

showuon commented Oct 3, 2023

@anmolnar , any update for the 3.8/3.9 version backport?

asfgit pushed a commit that referenced this pull request Oct 17, 2023
…2040)

* ZOOKEEPER-4728: force to re-resolve hostname into IP when binding

* ZOOKEEPER-4708: add test

(cherry picked from commit 40aed41)
Signed-off-by: Andor Molnar <andor@apache.org>
asfgit pushed a commit that referenced this pull request Oct 17, 2023
…2040)

* ZOOKEEPER-4728: force to re-resolve hostname into IP when binding

* ZOOKEEPER-4708: add test

(cherry picked from commit 40aed41)
Signed-off-by: Andor Molnar <andor@apache.org>
@anmolnar
Copy link
Contributor

@showuon Sorry. This is done now.

@showuon
Copy link
Contributor Author

showuon commented Oct 17, 2023

@anmolnar , thanks for the help! Could you also help review this PR: #2041 . They are basically trying to fix the similar issue.

AlphaCanisMajoris pushed a commit to AlphaCanisMajoris/zookeeper that referenced this pull request Mar 28, 2024
…pache#2040)

* ZOOKEEPER-4728: force to re-resolve hostname into IP when binding

* ZOOKEEPER-4708: add test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants