Description
There is a bug in package package gocbcore
file agentrouting.go
func applyConfig
...
// Identify all the dead servers and drain their requests
for _, oldServer := range oldRouting.servers {
found := false
for _, newServer := range newRouting.servers {
if newServer == oldServer
}
*if !found
*
}
...
connection to old server is not closed. This leads to connection leaks.
May be somewhere should be executed oldServer.Close() function
How to reproduce:
package main
import (
"fmt"
"time"
"github.com/couchbase/gocb"
)
func main() {
for i := 0; i < 10; i++ {
fmt.Println
time.Sleep(1 * time.Second)
cluster, err := gocb.Connect("couchbase://10.26.70.43")
if err != nil
bucket, err := cluster.OpenBucket("default", "")
if err != nil { panic(err) }
bucket.Close()
}
}
Couchbase should return list clustered servers as hostnames(not ips, because we used ip to connect) for example like
(
"server01.ds.xxx.net:11210",
"server02.ds.xxx.net:11210",
"server03.ds.xxx.net:11210"
)
then when couchbase go client will want to upgrade cluster view, it would add 10.26.70.43 address to oldServers and try to remove. Connection is still opened.
On unix system you can observe growing number of open file descriptors with command lsof -a -p <PID> | wc -l
where <PID> = process id of golang process
Also you can find in atach tcp dump, where you can see that some connections(that were removed during routeData updates) are not closed