scylladb / gocql

Package gocql implements a fast and robust ScyllaDB client for the Go programming language.
https://docs.scylladb.com/stable/using-scylla/drivers/cql-drivers/scylla-go-driver.html
BSD 3-Clause "New" or "Revised" License
169 stars 47 forks source link

"panic: no valid connect address for host" when establishing a session #191

Closed john-m-liu closed 3 weeks ago

john-m-liu commented 1 month ago

I originally opened this issue in the gocql repo, but I'm also opening it here because it's present in this fork as well. I'll copy the text of that issue here to make it easier to search here:


Please answer these questions before submitting your issue. Thanks!

What version of Cassandra are you using?

Scylla version 4.6.3

What version of Gocql are you using?

v1.11.0

What version of Go are you using?

1.22.4

What did you do?

call gocql.CreateSession() to connect to my cluster

What did you expect to see?

no error

What did you see instead?

the following panic:

panic: no valid connect address for host: . Is your cluster configured correctly?


If you are having connectivity related issues please share the following additional information

Describe your Cassandra cluster

please provide the following information


On this line in host_source.go, nil is always being passed as the connection address param. That nil connection address will eventually get passed to here, which will panic.

To reproduce, I simply ran the hello world example in https://github.com/gocql/gocql/blob/master/example_test.go and get this panic if I'm on https://github.com/gocql/gocql/commit/f42e40c76c55a5d8b9a9032f1916c8cde79b7639 or later. The hello world test passes if I'm on a commit earlier than that.

I suspect that I'm missing something obvious because if this is in fact an issue, it should prevent all users from being able to connect with the driver yet I don't see any mention of this issue. I'm encountering this when upgrading the scylla fork of the driver in my app from a version that does not contain this commit to a version that does

sylwiaszunejko commented 1 month ago

@john-m-liu For me https://github.com/gocql/gocql/blob/master/example_test.go works just fine, have you considered using more recent Scylla version? 4.6.3 if from 2 years ago, please upgrade and let me know if the issue still occurs.

dkropachev commented 1 month ago

@john-m-liu , Thanks for reporting it, I have double checked it on scylladb/scylla:4.6.3 and scylladb/scylla:latest it works just fine:

=== RUN   TestExampleTest
Tweet: 3afa26cb-2b94-11ef-bffb-64d69a667ec0 hello world

Tweet: 3afa26cb-2b94-11ef-bffb-64d69a667ec0 hello world
--- PASS: TestExampleTest (0.01s)
PASS

Is there something missing in reproduction steps you have described?

roydahan commented 1 month ago

In any case, scylla 4.6.3 is EOL, please retest with later scylla version (e.g. 5.4.x or 6.0.x)

john-m-liu commented 3 weeks ago

I was running scylla 4.6.3 via an image on a private docker registry and upgraded to a 5.4.x one from dockerhub, which seems to have fixed the issue. I debugged this a bit and it appears that the reason the driver failed with the private image is that the rpc_address setting wasn't set, but switching to the public one, that is set. So this appears to be user error.

Thanks for the help all!