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

Websocket fix #4945

Merged
merged 4 commits into from
Dec 5, 2021
Merged

Conversation

rustyrussell
Copy link
Contributor

I noticed that experimental-websocket-port didn't work on my node (it crashed). Along the way, I found a bug in DNS handling.

@SimonVrouwe
Copy link
Collaborator

Maybe off-topic, when I run test_announce_and_connect_via_dns on my local machine it fails with:

connectd: DNS with getaddrinfo gave: Name or service not known

Because that test expects a localhost.localdomain to be present?
'announce-addr': ['localhost.localdomain:12345'], # announce dns

But my machine (Debian) has .lan instead of .localdomain:

$ host localhost
localhost.lan has address 127.0.0.1
localhost.lan has IPv6 address ::1

Changing .localdomain to .lan makes the test pass, but is it correct?

@m-schmoock
Copy link
Collaborator

Changing .localdomain to .lan makes the test pass, but is it correct?

Yes it works, no its not correct. I was the assumption that "localdomain" is some sort of standard. Turns out it isn't. I didn't want to go for just "localhost" (which would work) because it can trigger certain internal code paths that shortcut address resolution to 127.0.0.1. I wanted the test to be in a way that it needs to run for getaddrinfo and let the system decide.

Copy link
Collaborator

@m-schmoock m-schmoock left a comment

Choose a reason for hiding this comment

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

Sure, when Websockets have empty addresses this should now work. Good that its now test covered.

Imho, the way opt_add_addr_withtype works is a little too iffy. But I also don't have a better idea.

tests/test_connection.py Outdated Show resolved Hide resolved
@SimonVrouwe
Copy link
Collaborator

Changing .localdomain to .lan makes the test pass, but is it correct?

Yes it works, no its not correct. I was the assumption that "localdomain" is some sort of standard. Turns out it isn't. I didn't want to go for just "localhost" (which would work) because it can trigger certain internal code paths that shortcut address resolution to 127.0.0.1. I wanted the test to be in a way that it needs to run for getaddrinfo and let the system decide.

It looks you can test what you have locally (.lan or .localdomain) using:
socket.getaddrinfo('localhost.localdomain', '12345')
returning error (or not): gaierror: [Errno -2] Name or service not known

@m-schmoock
Copy link
Collaborator

One stupid fix would be to add 127.0.0.1 localhost.localdomain to your /etc/hosts. But thats just a temporary solution if your annoyed by the test failing.

@SimonVrouwe
Copy link
Collaborator

One stupid fix would be to add 127.0.0.1 localhost.localdomain to your /etc/hosts. But thats just a temporary solution if your annoyed by the test failing.

Thanks, add it as an alias in /etc/hosts, like this:
127.0.0.1 localhost localhost.localdomain
and still works after restarting NetworkManager, so seems permanent.

@rustyrussell
Copy link
Contributor Author

We should reduce the scope of the localhost parsing perhaps: use it as a fallback iff no_dns is set, otherwise resolve it like anything else?

Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

ack 729eace

CI looks like fixed with #4954

@m-schmoock
Copy link
Collaborator

ack 729eace

…n same port.

We would fail connectd when listening on the IPv6 version failed; instead we should
allow that.

Changelog-Experimental: experimental-websocket-port fixed to work with default addresses.
Signed-off-by: Rusty Russell <[email protected]>
We treated ':' as an empty DNS name in EXPERIMENTAL, which is wrong.

Signed-off-by: Rusty Russell <[email protected]>
@rustyrussell
Copy link
Contributor Author

Trivial rebase on master to fix flake.

@m-schmoock
Copy link
Collaborator

ACK 6c21a6b

I restarted CI because it failed at flaky but unrelated tests/test_pay.py::test_fetchinvoice_3hop. Now its all good.

@m-schmoock m-schmoock merged commit 5284ee4 into ElementsProject:master Dec 5, 2021
@m-schmoock
Copy link
Collaborator

Whohoo, didn't know I had the permissions to do so, but the merge worked <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants