-
Notifications
You must be signed in to change notification settings - Fork 115
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
Change default APM server_url to 'http://127.0.0.1:8200' to avoid IPv6 ambiguity #727
Conversation
…6 ambiguity The current default APM server URL -- 'http://localhost:8200' -- is ambiguous. "localhost" can resolve to a '127.0.0.1' (IPv4) or '[::1]' (IPv6). At least in Node v17 the default `dns.lookup()` ordering of results was changed to no longer explicitly sort IPv4 addresses first. That means that on systems where the default resolver returns '[::1]' first for "localhost" will result in a broken attempt to talk to a default-configured local APM server: elastic/apm-agent-nodejs#3045 This is because APM server only binds to the IPv4 port: elastic/apm-server#1405
Is it possible for the system to be IPv6 only or less drastic case when list of addresses to which |
(Sorry for not having opened this as draft to start.) |
IPv6-only is likely possible yes. I’ve no encountered it. I think it would be rare, but am not sure. I can try to look at the Go lang docs to see if we think APM server would even listen on the IPv6 localhost by default in that case. Re: ‘localhost’ not resolving to 127.0.0.1. Oof, I would think that would be very unlikely but possible. I am not sure if some RFC has a “MUST” statement about “localhost” resolving so. If some user had this case, I am not sure we would feel the need to have the default agent and server configs successfully reach each other. I may be missing a legitimate use case though? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me. I agree with Trent that while there may be edge cases, I think a user with a host file that redirects localhost
or an ipv6-only system will be used to defaults not working.
The change makes sense 👍 . (On a side note, I'm just wondering though:
|
@z1c0 Possibly a lot. Here is the core node issue, which shows a number of incoming links from impacted projects. Also the links in that issue's description point to a number of back issues related to this.
There is some discussion in elastic/apm-server#1405 Interestingly https://pkg.go.dev/net#Listen says:
So it might be worth asking APM Server devs. I'll ask separately. |
APM server will be making the same change in elastic/apm-server#9749 |
E.g. Before this change the "add it to central config" link on the existing #727 goes to https://github.com/elastic/apm/specs/agents/configuration.md#adding-a-new-configuration-option which is a 404.
…7.0.0.1' rather than 'localhost' (#3049) Starting in node v17 the defaults for DNS resolution order was changed (nodejs/node#39987) such that `dns.lookup()` no longer sorted IPv4 addresses first. This impacts usage of the *default* APM Server URL (the `serverUrl` config var), 'http://localhost:8200', when using node >=17 because the APM server only binds to the IPv4 address by default (elastic/apm-server#1405). Fixes: #3045 Refs: elastic/apm#727
…7.0.0.1' rather than 'localhost' (elastic#3049) Starting in node v17 the defaults for DNS resolution order was changed (nodejs/node#39987) such that `dns.lookup()` no longer sorted IPv4 addresses first. This impacts usage of the *default* APM Server URL (the `serverUrl` config var), 'http://localhost:8200', when using node >=17 because the APM server only binds to the IPv4 address by default (elastic/apm-server#1405). Fixes: elastic#3045 Refs: elastic/apm#727
The current default APM server URL -- 'http://localhost:8200' -- is ambiguous. "localhost" can resolve to a '127.0.0.1' (IPv4) or '[::1]' (IPv6).
At least in Node v17 the default
dns.lookup()
ordering of results was changed to no longer explicitly sort IPv4 addresses first. That means that on systems where the default resolver returns '[::1]' first for "localhost" will result in a broken attempt to talk to a default-configured local APM server:elastic/apm-agent-nodejs#3045
This is because APM server only binds to the IPv4 port:
elastic/apm-server#1405
Checklist
sanitize_field_names
)CODEOWNERS
)To auto-merge the PR, add
/
schedule YYYY-MM-DD
to the PR description./schedule 2022-12-13