Skip to content

Make standalone to advertise "localhost" to avoid failure when hostname is not resolvable - #5856

Merged
tuteng merged 2 commits into
apache:masterfrom
merlimat:function-worker-service-url
Jan 4, 2020
Merged

Make standalone to advertise "localhost" to avoid failure when hostname is not resolvable#5856
tuteng merged 2 commits into
apache:masterfrom
merlimat:function-worker-service-url

Conversation

@merlimat

Copy link
Copy Markdown
Contributor

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.

@merlimat merlimat added the type/bug The PR fixed a bug or issue reported a bug label Dec 13, 2019
@merlimat merlimat added this to the 2.5.0 milestone Dec 13, 2019
@merlimat merlimat self-assigned this Dec 13, 2019
} else if (isBlank(config.getAdvertisedAddress())) {
// Use advertised address as local hostname
config.setAdvertisedAddress(ServiceConfigurationUtils.unsafeLocalhostResolve());
config.setAdvertisedAddress("localhost");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

run java8 tests

9 similar comments
@aahmed-se

Copy link
Copy Markdown
Contributor

run java8 tests

@sijie

sijie commented Dec 19, 2019

Copy link
Copy Markdown
Member

run java8 tests

@sijie

sijie commented Dec 19, 2019

Copy link
Copy Markdown
Member

run java8 tests

@sijie

sijie commented Dec 20, 2019

Copy link
Copy Markdown
Member

run java8 tests

@sijie

sijie commented Dec 24, 2019

Copy link
Copy Markdown
Member

run java8 tests

@sijie

sijie commented Dec 24, 2019

Copy link
Copy Markdown
Member

run java8 tests

@sijie

sijie commented Dec 24, 2019

Copy link
Copy Markdown
Member

run java8 tests

@sijie

sijie commented Dec 25, 2019

Copy link
Copy Markdown
Member

run java8 tests

@sijie

sijie commented Dec 30, 2019

Copy link
Copy Markdown
Member

run java8 tests

@sijie

sijie commented Jan 2, 2020

Copy link
Copy Markdown
Member

retest this please

@sijie

sijie commented Jan 2, 2020

Copy link
Copy Markdown
Member

run java8 tests

3 similar comments
@tuteng

tuteng commented Jan 3, 2020

Copy link
Copy Markdown
Member

run java8 tests

@tuteng

tuteng commented Jan 3, 2020

Copy link
Copy Markdown
Member

run java8 tests

@wolfstudy

Copy link
Copy Markdown
Member

run java8 tests

@tuteng
tuteng merged commit f95c71f into apache:master Jan 4, 2020
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/bug The PR fixed a bug or issue reported a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants