Make standalone to advertise "localhost" to avoid failure when hostname is not resolvable - #5856
Merged
Merged
Conversation
…me is not resolvable
rdhabalia
approved these changes
Dec 13, 2019
jerrypeng
approved these changes
Dec 13, 2019
sijie
reviewed
Dec 14, 2019
| } else if (isBlank(config.getAdvertisedAddress())) { | ||
| // Use advertised address as local hostname | ||
| config.setAdvertisedAddress(ServiceConfigurationUtils.unsafeLocalhostResolve()); | ||
| config.setAdvertisedAddress("localhost"); |
Member
There was a problem hiding this comment.
I feel it is better to try to add a method to ServiceConfigurationUtils to resolve localhost first. It is not resolved then fallback to use "localhost".
codelipenghui
approved these changes
Dec 17, 2019
Contributor
|
run java8 tests |
9 similar comments
Contributor
|
run java8 tests |
Member
|
run java8 tests |
Member
|
run java8 tests |
Member
|
run java8 tests |
Member
|
run java8 tests |
Member
|
run java8 tests |
Member
|
run java8 tests |
Member
|
run java8 tests |
Member
|
run java8 tests |
Member
|
retest this please |
Member
|
run java8 tests |
3 similar comments
Member
|
run java8 tests |
Member
|
run java8 tests |
Member
|
run java8 tests |
huangdx0726
pushed a commit
to huangdx0726/pulsar
that referenced
this pull request
Aug 24, 2020
…me is not resolvable (apache#5856) ### Motivation The standalone service is failing to startup when the hostname is not resolvable to an IP. This is common in laptops. The reason is that the function worker in standalone is trying to connect to the advertised address rather than "localhost". To fix this, we should make the standalone to always advertise "localhost" as the the broker address. This is ok because in any case the standalone treats the advertisement as the pulsar proxy, in that it forces the clients to always go through the same service url, so a client connecting from a different host won't have problems.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The standalone service is failing to startup when the hostname is not resolvable to an IP. This is common in laptops.
The reason is that the function worker in standalone is trying to connect to the advertised address rather than "localhost".
To fix this, we should make the standalone to always advertise "localhost" as the the broker address. This is ok because in any case the standalone treats the advertisement as the pulsar proxy, in that it forces the clients to always go through the same service url, so a client connecting from a different host won't have problems.