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

using --add-exclusive-node foo:28080 errors with: Failed to parse or resolve address from string: foo:28080 #8633

Closed
euri10 opened this issue Nov 9, 2022 · 4 comments · Fixed by #8643

Comments

@euri10
Copy link

euri10 commented Nov 9, 2022

in order to perform e2e tests I have set up a Dockerfile that spawns a regtest monerod, creates a predictible wallet and spawns a wallet rpc, all that handled by the might s6-overlay.

you can find an example here and clone it : https://gitlab.com/euri10/monero_docker_regtest.git

to run it just do docker compose up -d --build

the issue I'm facing is the following:
in monero_docker/root/etc/s6-overlay/s6-rc.d/monerod/run which is the scrippt that launches monerod I uses the --add-exclusive-node flag.

Now if you look more closely at https://gitlab.com/euri10/monero_docker_regtest/-/blob/main/src/root/etc/s6-overlay/s6-rc.d/monerod/run#L12-13
I pass the ip of the container to the --add-exclusive-node flag and it's working fine.

however, since the 2 containers are in the same network and are reachable I should not have to do the reverse lookup myself in the entry script,

if I uncomment line 12 and comment line 13, which I think is the right thing to do, then monerod complains with the following error:

monero_docker_regtest-foo-1  | 2022-11-09 17:06:24.696  I Initializing p2p server...
monero_docker_regtest-foo-1  | 2022-11-09 17:06:24.696  I Resolving node address: host=bar:29080, port=18080
monero_docker_regtest-foo-1  | 2022-11-09 17:06:24.697  E Failed to resolve host name 'bar:29080': Host not found (authoritative):1
monero_docker_regtest-foo-1  | 2022-11-09 17:06:24.697  E Failed to parse or resolve address from string: bar:29080
monero_docker_regtest-foo-1  | 2022-11-09 17:06:24.697  E Failed to handle command line

In essence, when I'm passing --add-exclusive-node bar:29080 monerod interprets it as if the host was bar:29080 and the port 18080 which is not the case, hopefully it should understand that bar is the host and 29080 is the port

@jeffro256
Copy link
Contributor

Does it work if you replace bar with the resolved IP address? IIRC, --add-exclusive-node does not resolve the hostname w/ DNS

@euri10
Copy link
Author

euri10 commented Nov 16, 2022

Does it work if you replace bar with the resolved IP address

yes, it does work with the resolved ip address, in fact that's the hack I'm doing right now starting the container after doing a dig +short bar and passing the result ip to the --add-exclusive-node flag.

? IIRC, --add-exclusive-node does not resolve the hostname w/ DNS

you cenrtainly know better the code, however the logs seems to indicate something different, this line in particular Resolving node address: host=bar:29080, port=18080
I feel like the host/port parsing fails at detecting I'm passing the host bar on port 29080 and treats the whole string bar:29080 as the entire host

@jeffro256
Copy link
Contributor

Huh, yeah looks like you found a bug! Try compiling #8643, run monerod with the patch and see if it works.

@euri10
Copy link
Author

euri10 commented Nov 17, 2022

amazing, I tested it and it's working great, can reach my containers with their host name now without having to dig for their ips !!
thanks a lot @jeffro256
can't wait for it to be in :)

jeffro256 added a commit to jeffro256/monero that referenced this issue Nov 18, 2022
Fixes monero-project#8633. The function `append_net_address` did not parse hostname + port addresses (e.g. `bar:29080`) correctly if the hostname did not contain a `'.'` character.

@vtnerd comments 1

clear up 2nd conditional statement
niklasha pushed a commit to niklasha/monero that referenced this issue Mar 18, 2024
Fixes monero-project#8633. The function `append_net_address` did not parse hostname + port addresses (e.g. `bar:29080`) correctly if the hostname did not contain a `'.'` character.

@vtnerd comments 1

clear up 2nd conditional statement
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 a pull request may close this issue.

2 participants