Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Using more than one cluster will crash ExpVar by reusing "ClusterSql" as exported name #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

annikahannig
Copy link

This patch fixes the following problem by introducing a "cluster id".

2015/07/24 10:16:53 Reuse of exported var name: ClusterSql
panic: Reuse of exported var name: ClusterSql
goroutine 1 [running]:
log.Panicln(0xc208031a78, 0x2, 0x2)
        /usr/local/Cellar/go/1.4.2/libexec/src/log/log.go:321 +0xb9
expvar.Publish(0x851d70, 0xa, 0x7f24b535f6a0, 0xc20910e940)
        /usr/local/Cellar/go/1.4.2/libexec/src/expvar/expvar.go:257 +0x1f4
expvar.NewMap(0x851d70, 0xa, 0xc20910df20)
        /usr/local/Cellar/go/1.4.2/libexec/src/expvar/expvar.go:287 +0xc3
github.com/benthor/clustersql.NewDriver(0x7f24b535f678, 0xfe51b0, 0x0, 0x0, 0x0, 0x0)
        /Users/benutzer/go/src/github.com/benthor/clustersql/cluster.go:178 +0x4b
[...truncated...]

@benthor
Copy link
Owner

benthor commented Jul 24, 2015

Good find, although I'd rather not change the API. Maybe look into adding a counter to the expvar name that gets increased for every new instanciation?

@annikahannig
Copy link
Author

You are right: an breaking API change should be the last straw to grasp.
How about exporting the driver stats as an array: "ClusterSql": [ ... ] then?

@Ivanezko
Copy link

Any updates?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants