Skip to content

Improve warning when initial connection is to host with rpc_address of 0.0.0.0 #113

@absurdfarce

Description

@absurdfarce

This case leads to the following error message:

{"level":"error","ts":1674158444.9508557,"caller":"proxycore/cluster.go:357","msg":"unable to create new endpoint","error":"ignoring host because its `peer` is not set or is invalid","stacktrace":
"github.com/datastax/cql-proxy/proxycore.(*Cluster).addHosts\n\t/go/src/cql-proxy/proxycore/cluster.go:357
github.com/datastax/cql-proxy/proxycore.(*Cluster).queryHosts\n\t/go/src/cql-proxy/proxycore/cluster.go:300
github.com/datastax/cql-proxy/proxycore.(*Cluster).connect\n\t/go/src/cql-proxy/proxycore/cluster.go:223
github.com/datatax/cql-proxy/proxycore.ConnectCluster\n\t/go/src/cql-proxy/proxycore/cluster.go:163
github.com/datastax/cql-proxy/proxy.(*Proxy).Connect\n\t/go/src/cql-proxy/proxy/proxy.go:167
github.com/datastax/cql-proxy/proxy.(*runConfig).listenAndServe\n\t/go/src/cql-proxy/proxy/run.go:274
github.com/datastax/cql-proxy/proxy.Run\n\t/go/src/cql-proxy/proxy/run.go:195
main.main\n\t/go/src/cql-proxy/proxy.go:29
runtime.main\n\t/usr/local/go/src/runtime/proc.go:225"}                                                                          
panic: runtime error: index out of range [0] with length 0

Relevant code is NewEndpoint. This code starts with "rpc_address" and falls back to "peer" if that's set to 0.0.0.0. This doesn't work for system.local, though, where "peer" is not a defined column. Thus we wind up with the error message above which doesn't really communicate what's going on.

It would be nice if we could provide a more informative error to the user, at least something indicating that 0.0.0.0 rpc_addresses will introduce this behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions