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

Connection leaks during routeData updates in agentrouting.go

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.1.1
    • Component/s: library
    • Labels:
    • Environment:
      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

          Hide
          build-team Couchbase Build Team added a comment -

          Build 5.0.0-2257 contains gocb commit 49604b8396a62ba097b1ba2c0a32beeafff3e2a1 with commit message:
          GOCBC-124: Properly close connections after shutdown.
          https://github.com/couchbase/gocb/commit/49604b8396a62ba097b1ba2c0a32beeafff3e2a1

          Show
          build-team Couchbase Build Team added a comment - Build 5.0.0-2257 contains gocb commit 49604b8396a62ba097b1ba2c0a32beeafff3e2a1 with commit message: GOCBC-124 : Properly close connections after shutdown. https://github.com/couchbase/gocb/commit/49604b8396a62ba097b1ba2c0a32beeafff3e2a1
          Hide
          build-team Couchbase Build Team added a comment -

          Build 5.0.0-2592 contains gocb commit 49604b8396a62ba097b1ba2c0a32beeafff3e2a1 with commit message:
          GOCBC-124: Properly close connections after shutdown.
          https://github.com/couchbase/gocb/commit/49604b8396a62ba097b1ba2c0a32beeafff3e2a1

          Show
          build-team Couchbase Build Team added a comment - Build 5.0.0-2592 contains gocb commit 49604b8396a62ba097b1ba2c0a32beeafff3e2a1 with commit message: GOCBC-124 : Properly close connections after shutdown. https://github.com/couchbase/gocb/commit/49604b8396a62ba097b1ba2c0a32beeafff3e2a1

            People

            • Assignee:
              brett19 Brett Lawson
              Reporter:
              mishapolyakov.ts73 Mykhailo
            • 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

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.