Hello,
I am writing a simple application to read/write data to Couchbase using gopkg.in/couchbase/gocb.v1
Problem: When application is built for Linux, its constantly opening new connections to CB ( 10-20 per second ) until it eventually crashes. The Get/Upsert operations succeed, but the number of threads is constantly increasing. This behavior does not happen when running on Mac, only Linux
Go Version : go1.15.2
When I build/run locally on my a mac, it only opens 10 connections and I see this in the logs
GOCB 21:19:03.265121 agentrouting.go:138: Authenticating…
GOCB 21:19:03.275375 agent.go:797: Attempting to request CCCP configuration
GOCB 21:19:03.281946 agent.go:826: Using network type default for connections
GOCB 21:19:03.281972 agent.go:833: Successfully connected
GOCB 15:57:14.420686 agentcccpcfg.go:76: CCCPPOLL: Received new config
GOCB 15:57:14.420732 agentrouting.go:232: Ignoring configuration with identical revision number
When built/run on Linux, the number of connections grows at a rate of 10-20 per second, and it keeps switching routing data:
GOCB 21:19:03.265121 agentrouting.go:138: Authenticating…
GOCB 21:19:03.275375 agent.go:797: Attempting to request CCCP configuration
GOCB 21:19:03.281946 agent.go:826: Using network type default for connections
GOCB 21:19:03.281972 agent.go:833: Successfully connected
GOCB 15:57:14.420686 agentcccpcfg.go:76: CCCPPOLL: Received new config
GOCB 21:07:01.033814 agentrouting.go:245: Switching routing data (update)…
GOCB 21:07:01.033974 agentrouting.go:246: New Routing Data:
Sample Code:
var cbBucket *gocb.Bucket
var bucketName = "testBucket"
cx := "couchbase://" + cbHost
cluster, err := gocb.Connect(cx)
cluster.Authenticate(gocb.PasswordAuthenticator{
Username: cbUser,
Password: viper.GetString("CB_PASS"),
})
if err != nil {
log.Println("Error connecting to Couchbase:", err)
panic(err)
}
bucket, err := cluster.OpenBucket(bucketName, "")
cbBucket = bucket
if err != nil {
log.Println("Error connecting to Bucket:", err)
panic(err)
}
var Data DataStruct
cas, err := cbBucket.Get(document, &Data)
Just looking for ways to debug this behavior. Seems to be something related to