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

XDCR - race condition in DCP

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 7.1.0
    • 7.1.0
    • XDCR
    • Untriaged
    • 1
    • Unknown

    Description

      When running race detector, this stack trace showed up.
      Seems to not affect any current test runs but would be good to investigate.

      ==================
      WARNING: DATA RACE
      Write at 0x00c000bfd400 by goroutine 637:
        github.com/couchbase/goxdcr/base.Uint16List.Swap()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/base/simple_utils.go:109 +0xe5
        github.com/couchbase/goxdcr/base.(*Uint16List).Swap()
            <autogenerated>:1 +0x2e
        sort.medianOfThree()
            /Users/neil.huang/.cbdepscache/exploded/x86_64/go-1.16.5/go/src/sort/sort.go:90 +0x14f
        sort.doPivot()
            /Users/neil.huang/.cbdepscache/exploded/x86_64/go-1.16.5/go/src/sort/sort.go:114 +0x5e4
        sort.quickSort()
            /Users/neil.huang/.cbdepscache/exploded/x86_64/go-1.16.5/go/src/sort/sort.go:203 +0xa5
        sort.Sort()
            /Users/neil.huang/.cbdepscache/exploded/x86_64/go-1.16.5/go/src/sort/sort.go:231 +0x87
        github.com/couchbase/goxdcr/base.SortUint16List()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/base/simple_utils.go:113 +0x528
        github.com/couchbase/goxdcr/parts.(*DcpNozzle).initialize()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/parts/dcp_nozzle.go:638 +0x4b3
        github.com/couchbase/goxdcr/parts.(*DcpNozzle).Start()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/parts/dcp_nozzle.go:754 +0x37c
        github.com/couchbase/goxdcr/pipeline.(*GenericPipeline).startPart()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/pipeline/generic_pipeline.go:229 +0x301
        github.com/couchbase/goxdcr/pipeline.(*GenericPipeline).startPartsWithTimeout.func1.1()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/pipeline/generic_pipeline.go:149 +0x13a
       
      Previous read at 0x00c000bfd400 by goroutine 679:
        github.com/couchbase/goxdcr/parts.(*DcpNozzle).getDcpStreams()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/parts/dcp_nozzle.go:1497 +0xda
        github.com/couchbase/goxdcr/parts.(*DcpNozzle).inactiveDcpStreams()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/parts/dcp_nozzle.go:1507 +0x2e4
        github.com/couchbase/goxdcr/parts.(*DcpNozzle).onUpdateStartingSeqno()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/parts/dcp_nozzle.go:1628 +0x246
        github.com/couchbase/goxdcr/parts.(*DcpNozzle).UpdateSettings()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/parts/dcp_nozzle.go:1565 +0x2fd
        github.com/couchbase/goxdcr/pipeline.(*GenericPipeline).UpdateSettings()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/pipeline/generic_pipeline.go:904 +0xb61
        github.com/couchbase/goxdcr/pipeline_svc.(*CheckpointManager).setTimestampForVB()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/pipeline_svc/checkpoint_manager.go:1176 +0x522
        github.com/couchbase/goxdcr/pipeline_svc.(*CheckpointManager).startSeqnoGetter()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/pipeline_svc/checkpoint_manager.go:1215 +0x4ec
       
      Goroutine 637 (running) created at:
        github.com/couchbase/goxdcr/pipeline.(*GenericPipeline).startPartsWithTimeout.func1()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/pipeline/generic_pipeline.go:147 +0x215
        github.com/couchbase/goxdcr/base.ExecWithTimeout.func1()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/base/simple_utils.go:47 +0x34
       
      Goroutine 679 (running) created at:
        github.com/couchbase/goxdcr/pipeline_svc.(*CheckpointManager).SetVBTimestamps()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/pipeline_svc/checkpoint_manager.go:1008 +0x110a
        github.com/couchbase/goxdcr/factory.(*XDCRFactory).SetStartSeqno()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/factory/xdcr_factory.go:870 +0xd5
        github.com/couchbase/goxdcr/factory.(*XDCRFactory).SetStartSeqno-fm()
            /Users/neil.huang/source/couchbase/goproj/src/github.com/couchbase/goxdcr/factory/xdcr_factory.go:862 +0x6a
      ==================
      

      Attachments

        For Gerrit Dashboard: MB-49114
        # Subject Branch Project Status CR V

        Activity

          Build couchbase-server-7.1.0-2108 contains goxdcr commit 7531fba with commit message:
          MB-49114: Fix race on dcp.vbnos

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.1.0-2108 contains goxdcr commit 7531fba with commit message: MB-49114 : Fix race on dcp.vbnos

          dcp.vbnos is now protected with RWLock. The read lock is attempted to be acquired only if the dcp.state is in Inital or Starting phase. This was done to restrict copying of vbnos at selective call sites.

          sudeep.jathar Sudeep Jathar added a comment - dcp.vbnos is now protected with RWLock. The read lock is attempted to be acquired only if the dcp.state is in Inital or Starting phase. This was done to restrict copying of vbnos at selective call sites.

          People

            sudeep.jathar Sudeep Jathar
            neil.huang Neil Huang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change

                PagerDuty