Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Check shard name before establising connection #739

Merged
merged 1 commit into from
Aug 12, 2024
Merged

Check shard name before establising connection #739

merged 1 commit into from
Aug 12, 2024

Conversation

diPhantxm
Copy link
Collaborator

@diPhantxm diPhantxm commented Aug 12, 2024

if no shards are specified, router panics when trying to connect to it

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xeb7810]

goroutine 35 [running]:
github.com/pg-sharding/spqr/pkg/pool.(*InstancePoolImpl).Connection(0x400030a7e0, 0xffffffffffffffff, {{0x0, 0x0}, 0x0}, {0x0, 0x0})
        /spqr/pkg/pool/dbpool.go:224 +0x100
github.com/pg-sharding/spqr/router/route.(*Route).Params(0x400030a840)
        /spqr/router/route/route.go:95 +0x1d8
github.com/pg-sharding/spqr/router/client.(*PsqlClient).Auth(0x4000207e60, 0x400030a840)
        /spqr/router/client/client.go:740 +0x498
github.com/pg-sharding/spqr/router/rulerouter.(*RuleRouterImpl).PreRoute(0x400038e050, {0x1673970, 0x4000061b60}, 0x3)
        /spqr/router/rulerouter/rulerouter.go:228 +0x830
github.com/pg-sharding/spqr/router/instance.(*InstanceImpl).serv(0x4000380300, {0x1673970, 0x4000061b60}, 0x3)
        /spqr/router/instance/instance.go:160 +0x6c
github.com/pg-sharding/spqr/router/instance.(*InstanceImpl).Run.func4()
        /spqr/router/instance/instance.go:245 +0x40
created by github.com/pg-sharding/spqr/router/instance.(*InstanceImpl).Run in goroutine 23
        /spqr/router/instance/instance.go:244 +0x730

Now it will return "shard with name "" not found"

@reshke reshke merged commit b92ea0c into master Aug 12, 2024
27 checks passed
@reshke reshke deleted the no-shards branch October 31, 2024 06:42
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants