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

DcpProducer needs a consistent mechanism for access to the backfillMgr (shared_ptr)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • backlog
    • master
    • couchbase-bucket
    • None
    • Untriaged
    • 0
    • Unknown

    Description

      Issue flagged from TSAN when adding new code to the DcpProducer.

      In DcpProducer we have patterns like

      if (backfillMgr) {
         backfillMgr->doThing();
      }
      

      Or even just unguarded calls

      backfillMgr->doThing();
      

      A new change for MB-57772 (which did the first pattern) triggered a TSAN warning, because DcpProducer::closeAllStreams will call reset on the backfillMgr shared_ptr - so clearly we could on one line read and believe the backfillMgr has a pointer, but on the second line crash when dereferencing a now nullptr.

      T1                          |    T2
                                  |
      if (backfillMgr)            | 
                                  |    backfillMgr.reset();
                                  |
         backfillMgr->doThing();  |
         CRASHED                  | 
      

      We need a safer way of managing access to the backfillMgr (e.g. folly::sync)

      Attachments

        Issue Links

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

          Activity

            People

              jwalker Jim Walker
              jwalker Jim Walker
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty