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

Allow configuration of host_name when starting cnode #91

Closed
sax opened this issue Jul 20, 2021 · 5 comments
Closed

Allow configuration of host_name when starting cnode #91

sax opened this issue Jul 20, 2021 · 5 comments

Comments

@sax
Copy link

sax commented Jul 20, 2021

Here's a (hopefully) brief description of the problem.

We're trying to start an application that only has IPv6 addresses on its local network. When starting the application with export ELIXIR_ERL_OPTIONS="-proto_dist inet6_tcp", the application can not connect to any CNodes that are started by Bundlex.

We've tracked down the fact that Erlang CNodes do not support IPv6 as referenced in the following paragraph from the Erlang docs (emphasis added):

The addr argument of the listen, accept, and connect callbacks refer to appropriate address structure for currently used protocol. Currently ei only supports IPv4. That is, at this time addr always points to a struct sockaddr_in structure.

I fought with this for a while, and so far the only thing that seems to work is to start the parent application epmdless using the ERL_DIST_PORT variable. This allows me to set the RELEASE_NODE variable to a string including the IPv6 address, which will allow application nodes to connect to each other.

The problem is that Bundlex starts the CNode with the same IPv6 address as the host_name part of the node's name. If we hard-code Bundlex to start the CNode with the host name 127.0.0.1, then the parent application starts epmdless, but uses epmd on localhost to connect to the CNodes (and succeeds).

@sax
Copy link
Author

sax commented Jul 20, 2021

One thought that I had was to have a global configuration to override specific parts of Bundlex. For example:

config :bundlex, :host_name, "127.0.0.1"

@mat-hek
Copy link
Member

mat-hek commented Jul 22, 2021

I think we can add such a config, but it seems not to be a problem with Bundlex, but with ei_connect in the first place. I see no reason why it couldn't support IPv6, and using epmdless here is rather a workaround. Would you mind opening a similar issue in the OTP repo too?

@sax
Copy link
Author

sax commented Jul 22, 2021

I agree that the better fix is in OTP, and I have filed erlang/otp#5068 to see if that can be solved upstream. In the short term, I'll issue a pull request for this configuration change.

@sax
Copy link
Author

sax commented Jul 24, 2021

The code to update Bundlex to accept a host_name config is simple, but I'm running into compatibility issues with Unifex. It looks like the master branch of Bundlex has changed to pass the erlang cookie via BUNDLEX_ERLANG_COOKIE, but Unifex still expects it via args.

I do not see any open branches on Unifex supporting the cookie env change... is there somewhere else I should be looking?

@mat-hek
Copy link
Member

mat-hek commented Jul 26, 2021

Good point, I've updated Bundlex in Unifex v0.5.0

@mat-hek mat-hek closed this as completed May 13, 2022
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

No branches or pull requests

2 participants