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

Memory leak in BackfillManager due to circular dependancy with DcpProducer

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.1.1
    • 4.0.0, 4.1.0
    • couchbase-bucket
    • Security Level: Public
    • None
    • Untriaged
    • Yes

    Description

      From Jim Walker:

      The DcpProducer cannot be deleted because its deletion is performed via a smart pointer, but the DcpProducer in 4.0 is effectively
      holding a reference to itself.

      http://src.couchbase.org/source/xref/sherlock/ep-engine/src/dcp-producer.cc#80

      That line of code passes “this" to BackfillManager and stored inside the manager as a smart pointer. By line 81 the DcpProducer has a reference of 1
      and thus can never be deleted via the smart pointer cleanup we rely upon.

      The leak though we are exposed to means that a DCP connection that is terminated will leak a DcpProducer object which I’ve calculated to be
      less than 400 bytes.

      This leak will be for every terminated DCP producer, be clean terminate or a connection-reset.

      Attachments

        Issue Links

          Activity

            People

              jwalker Jim Walker
              drigby Dave Rigby (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty