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

[RPC] Prefer IPv4 between IPv4 and IPv6 #7013

Merged
merged 1 commit into from
Dec 3, 2020

Conversation

echuraev
Copy link
Contributor

@echuraev echuraev commented Dec 2, 2020

This change fix problem with version of IP protocol on MacOS.

Previous the rpc_tracker and query_rpc_tracker were not able connect to
each other with default hostnames.
The root cause was in method socket.getaddrinfo. In rpc_tracker the
default hostname was "0.0.0.0" and getaddrinfo returned IPv4 type. In
query_rpc_tracker the default hastname is "localhost" and getaddrinfo
on MacOS returns IPv6 type. Note: on Linux both have IPv4 type.
These tools worked by different protocols and this is why
query_rpc_tracker wasn't able connect to rpc_tracker.

Now the default hostnames are the same. So it works fine on MacOS.

@tqchen, @jroesch Could you please review it?

@echuraev
Copy link
Contributor Author

echuraev commented Dec 2, 2020

And just a question to this PR. Maybe the better option is to set IPv4 type for all rpc connections? Or sometimes it is reasonable to have IPv6?

@@ -33,7 +33,7 @@ def main(args):

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--host", type=str, default="0.0.0.0", help="the hostname of the tracker")
parser.add_argument("--host", type=str, default="localhost", help="the hostname of the tracker")
Copy link
Member

Choose a reason for hiding this comment

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

This might prevent rpc tracker from being used other than local host

@tqchen
Copy link
Member

tqchen commented Dec 2, 2020

Thanks @echuraev It is indeed good to support IPv6, although the current change could make rpc tracker unavailable from other machines. The second best option is indeed to check and use 0.0.0.0 for now if the default one is ipv6

@echuraev
Copy link
Contributor Author

echuraev commented Dec 3, 2020

I've updated the PR. Now we will prefer IPv4 type of IP protocol between IPv4 and IPv6. @tqchen please, take a look on it.

This change fix problem with version of IP protocol on MacOS.  Previous
the `rpc_tracker` and `query_rpc_tracker` were not able connect to each
other with default hostnames.

The root cause was in method `socket.getaddrinfo`. In `rpc_tracker` the
default hostname is "0.0.0.0" and `getaddrinfo` returns IPv4 type. In
`query_rpc_tracker` the default hastname is "localhost" and
`getaddrinfo` on MacOS returns IPv6 type. Note: on Linux both have IPv4
type.
These tools worked by different protocols and this is why
`query_rpc_tracker` wasn't able connect to `rpc_tracker`.

Now we will prefer IPv4 type. And both `rpc_tracker` and
`query_rpc_tracker` will use the same version of protocol.
@tqchen tqchen merged commit c1f7820 into apache:main Dec 3, 2020
@echuraev echuraev deleted the rpc_tracker_macos_fix branch December 4, 2020 05:08
@echuraev echuraev changed the title Change default hostname in rpc_tracker [RPC] Prefer IPv4 between IPv4 and IPv6 Dec 4, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 4, 2020
This change fix problem with version of IP protocol on MacOS.  Previous
the `rpc_tracker` and `query_rpc_tracker` were not able connect to each
other with default hostnames.

The root cause was in method `socket.getaddrinfo`. In `rpc_tracker` the
default hostname is "0.0.0.0" and `getaddrinfo` returns IPv4 type. In
`query_rpc_tracker` the default hastname is "localhost" and
`getaddrinfo` on MacOS returns IPv6 type. Note: on Linux both have IPv4
type.
These tools worked by different protocols and this is why
`query_rpc_tracker` wasn't able connect to `rpc_tracker`.

Now we will prefer IPv4 type. And both `rpc_tracker` and
`query_rpc_tracker` will use the same version of protocol.
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Dec 4, 2020
This change fix problem with version of IP protocol on MacOS.  Previous
the `rpc_tracker` and `query_rpc_tracker` were not able connect to each
other with default hostnames.

The root cause was in method `socket.getaddrinfo`. In `rpc_tracker` the
default hostname is "0.0.0.0" and `getaddrinfo` returns IPv4 type. In
`query_rpc_tracker` the default hastname is "localhost" and
`getaddrinfo` on MacOS returns IPv6 type. Note: on Linux both have IPv4
type.
These tools worked by different protocols and this is why
`query_rpc_tracker` wasn't able connect to `rpc_tracker`.

Now we will prefer IPv4 type. And both `rpc_tracker` and
`query_rpc_tracker` will use the same version of protocol.
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
This change fix problem with version of IP protocol on MacOS.  Previous
the `rpc_tracker` and `query_rpc_tracker` were not able connect to each
other with default hostnames.

The root cause was in method `socket.getaddrinfo`. In `rpc_tracker` the
default hostname is "0.0.0.0" and `getaddrinfo` returns IPv4 type. In
`query_rpc_tracker` the default hastname is "localhost" and
`getaddrinfo` on MacOS returns IPv6 type. Note: on Linux both have IPv4
type.
These tools worked by different protocols and this is why
`query_rpc_tracker` wasn't able connect to `rpc_tracker`.

Now we will prefer IPv4 type. And both `rpc_tracker` and
`query_rpc_tracker` will use the same version of protocol.
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 this pull request may close these issues.

2 participants