Misleading Error about Invalid Hostname when port not included

Moved from GitHub dgraph/5348

Posted by darkn3rd:

CONFIGURATION

Dgraph Version: v20.03.1
OS: Ubuntu 18.04.3 LTS

$ grep $(hostname -f) /etc/hosts 
127.0.1.1	ubuntu1804.localdomain
127.0.0.1 ubuntu1804.localdomain

STEPS TO REPRODUCE

curl -sSf https://get.dgraph.io | ACCEPT_LICENSE=y VERSION=v20.03.1 bash
dgraph zero --my="$(hostname -f):5080" --idx 1
dgraph alpha --my=$(hostname -f) --zero $(hostname -f):5080 -lru_mb 2048

EXPECTED RESULT

An error message about the port not existing, or default it to 7080.

ACTUAL RESULT

2020/05/02 00:38:02 ubuntu1804.localdomain is not valid address
github.com/dgraph-io/dgraph/x.AssertTruef
	/ext-go/1/src/github.com/dgraph-io/dgraph/x/error.go:101
github.com/dgraph-io/dgraph/worker.StartRaftNodes
	/ext-go/1/src/github.com/dgraph-io/dgraph/worker/groups.go:83
github.com/dgraph-io/dgraph/dgraph/cmd/alpha.run.func4
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/alpha/run.go:663
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1373

danielmai commented :

The default for the --my option is set to localhost:7080. We shouldn’t try to be smart and fill in a default port if only that part is missing.

We can improve the error messaging for this. In this case, the port is wrong, so the error message should say that.

SezalAgrawal commented :

@danielmai Can I pick this task?

Hey, This issue has been fixed by this PR.

1 Like