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

cli: init fails with IPv6 literal #33008

Closed
janartodesk opened this issue Dec 11, 2018 · 6 comments · Fixed by #37977
Closed

cli: init fails with IPv6 literal #33008

janartodesk opened this issue Dec 11, 2018 · 6 comments · Fixed by #37977
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Comments

@janartodesk
Copy link

Describe the problem

Attempting to initialize IPv6 only cluster fails with address parsing error:

root@db1 ~ # cockroach init --certs-dir=/root/.cockroach-certs/ --host=[fd00:beef:db::1]:6257
E181211 08:49:05.678188 1 cli/error.go:230  server closed the connection.
Is this a CockroachDB node?

initial connection heartbeat failed: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp: address [[fd00:beef:db::1]]:6257: missing port in address"
Error: server closed the connection.
Is this a CockroachDB node?

initial connection heartbeat failed: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp: address [[fd00:beef:db::1]]:6257: missing port in address"
Failed running "init"

To Reproduce

Start a cluster binding to IPv6 addresses and attempt to initialize it.

Additional data

We use in-house PKI for managing cluster's certificates.

Starting and initializing the cluster on IPv4 addresses (using our own TLS certificates) works as expected:

root@db1 ~ # cockroach init --certs-dir=/root/.cockroach-certs/ --host=172.32.0.1:6257
Cluster successfully initialized

There are no IPv6 connectivity issues between hosts. Initializing the cluster on IPv4 then reconfiguring and restarting the already initialized cluster on IPv6 managed to bring it up.

All the IP addresses in question are public and globally routable, replaced in the excerpts with pseudo random private addresses.

Environment:

  • CockroachDB version 2.1.2
  • Server OS: Ubuntu 18.04
  • Client app: cockroach init

Servers are started using following configuration:

/usr/local/bin/cockroach start \
--certs-dir=/usr/local/etc/cockroach \
--advertise-addr=[fd00:beef:db::1]:6257 \
--listen-addr=[fd00:beef:db::1]:6257 \
--http-addr=127.0.0.1:8080 \
--join=[fd00:beef:db::1]:6257,[fd00:beef:db::2]:6257,[fd00:beef:db::3]:6257 \
--cache=.25 \
--max-sql-memory=.25 \
--locality=cluster=test \
--store=/usr/local/lib/cockroach \
--log-dir="" \
--logtostderr=WARNING

@tbg
Copy link
Member

tbg commented Dec 11, 2018

@janartodesk thank you for your report. I'm not sure this is relevant, but it looks like you're using --host which I think has been deprecated in favor of --listen-addr.

I don't think this is the root cause though, since I get the following error if I try it:

Error: cockroach server exited with error: consider changing the port via --listen-addr: listen tcp [fe80::4001:aff:fe8e:7:1234]:26257: bind: invalid argument
Failed running "start"

@tbg tbg added the A-cli label Dec 11, 2018
@tbg
Copy link
Member

tbg commented Dec 11, 2018

@bdarnell or @mberhault, this looks like one of your areas of expertise.

@bdarnell bdarnell changed the title IPv6 cluster initialization fails cli: init fails with IPv6 literal Dec 11, 2018
@bdarnell
Copy link
Contributor

@tbg This is a client-side command (the server side is correctly using --listen-addr)

@janartodesk Thanks for the report, this looks like a bug in our address parsing that affects cockroach init (and a few other commands that use GRPC instead of the SQL interface). Notice the double square brackets in the error messages.

As a workaround, if you can set up DNS names for these IPv6 addresses, that should work.

@knz knz added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Dec 11, 2018
@janartodesk
Copy link
Author

As a workaround, if you can set up DNS names for these IPv6 addresses, that should work.

Oh yeah, didn't think of that.

Thanks, guys!

@andreimatei
Copy link
Contributor

@knz are you interested in doing something about this one?
It's gotten to be a hot issue cause more people are complaining about it. It sounds like it's probably a simple fix and I know you heart ipv6.

@knz
Copy link
Contributor

knz commented Jun 3, 2019

Sounds like a plan.

craig bot pushed a commit that referenced this issue Jun 3, 2019

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
37942: sql: Adding support for show indexes from database command r=rohany a=rohany

As requested in #37270, support for a show indexes from database command would be helpful. This PR includes support for the command in the parser. Future PR's will implement the functionality of the parsed results.

37977: cli: fix use of IPv6 addresses with RPC client commands r=knz a=knz

Fixes #33008.

(This was actually a regression of my doing, back from #28373. Didn't pick it up back then because we didn't have a test.)

Release note (bug fix): the `cockroach` command line utilities that
internally use a RPC connection (e.g. `cockroach quit`, `cockroach
init`, etc) again properly support passing an IPv6 address literal via
the `--host` argument.

Co-authored-by: Rohan Yadav <[email protected]>
Co-authored-by: Raphael 'kena' Poss <[email protected]>
@craig craig bot closed this as completed in #37977 Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants