Uploaded image for project: 'Couchbase Go SDK'
  1. Couchbase Go SDK
  2. GOCBC-124

Connection leaks during routeData updates in agentrouting.go

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.1.1
    • 1.1.0
    • library
    • rhell 6.7

    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

      { found = true break }

      }
      *if !found

      { go agent.shutdownPipeline(oldServer) }

      *
      }
      ...

      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

      { panic(err) }
      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

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            brett19 Brett Lawson
            mishapolyakov.ts73 Mykhailo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty