Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-31269

incorrect exclusive unlock in gencache - should be read unlock

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 5.5.2, 6.0.0, 6.5.0
    • 4.5.1, 4.6.5, 5.0.1, 5.1.2, 5.5.1, 6.0.0, 6.5.0
    • query
    • None
    • Untriaged
    • No

    Description

      There's a very rare race condition when an entry is being deleted and the cache is being scanned in its vicinity where the engine might panic with the following:

      fatal error: sync: Unlock of unlocked RWMutex
       
      goroutine 594195840 [running]:
      runtime.throw(0xe99217, 0x20)
              /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.1/go/src/runtime/panic.go:596 +0x95 fp=0xc43033cd70 sp=0xc43033cd50
      sync.throw(0xe99217, 0x20)
              /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.1/go/src/runtime/panic.go:585 +0x35 fp=0xc43033cd90 sp=0xc43033cd70
      sync.(*RWMutex).Unlock(0xc420150df8)
              /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.1/go/src/sync/rwmutex.go:118 +0xa7 fp=0xc43033cdc0 sp=0xc43033cd90
      github.com/couchbase/query/util.(*GenCache).ForEach(0xc420150d80, 0xc43033ce40, 0xc424b4cfc0)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/util/cache.go:351 +0x26f fp=0xc43033ce28 sp=0xc43033cdc0
      github.com/couchbase/query/server/http.(*activeHttpRequests).ForEach(0xc42000e070, 0xc424b4cf80, 0xc424b4cfc0)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/server/http/service_endpoint.go:268 +0x61 fp=0xc43033ce60 sp=0xc43033ce28
      github.com/couchbase/query/server.ActiveRequestsForEach(0xc424b4cf80, 0xc424b4cfc0)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/server/request.go:153 +0x49 fp=0xc43033ce88 sp=0xc43033ce60
      github.com/couchbase/query/datastore/system.(*activeRequestsIndex).ScanEntries(0xc4205a2c40, 0xc423a004e0, 0x24, 0x7fffffffffffffff, 0xe84b87, 0x9, 0x16b2e80, 0xc430547020, 0xc427282450)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/datastore/system/system_keyspace_actives.go:439 +0x19d fp=0xc43033cf28 sp=0xc43033ce88
      github.com/couchbase/query/execution.(*PrimaryScan).scanEntries(0xc4255a6c00, 0xc420f45040, 0xc427282450)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/execution/scan_primary.go:198 +0x1ba fp=0xc43033cfc8 sp=0xc43033cf28
      runtime.goexit()
              /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.1/go/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc43033cfd0 sp=0xc43033cfc8
      created by github.com/couchbase/query/execution.(*PrimaryScan).scanPrimary
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/execution/scan_primary.go:63 +0x11d
      

      The code is switching from read lock to exclusive lock, and the exclusive unlock is actually a typo, it should a read unlock

      Attachments

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

        Activity

          People

            ritam.sharma Ritam Sharma
            marco.greco Marco Greco (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty