Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-2693

LiveQuerier could be leaked as liveQuerierStopped() delegate might not be called

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.1.0
    • 3.0
    • LiteCore
    • Security Level: Public
    • None
    • 2

    Description

      Based on the recent fix for CBL-2673 that adds liveQuerierStopped() to LiveQuerierDelegate for notifying when the LiveQuerier is completely stopped so that its consumer (C4Query) knows when it can break up the retained cycle b/w itself and the delegate object and cleanup the memory. 

      However there is a bug in LiveQuerier::_stop() that _delegate.liveQuerierStopped() might not be called if the _query object is not initialized in the _runQuery() yet when the _stop() is called. This issue has been found when running "Close Database with Active Live Query" test in CBL-C; the test was failed as the the c4Query and LiveQuerier object were leaked after the test was done.

      After discussing with Jim Borden, the fix would be that 
      1. _delegate.liveQuerierStopped() will be called whether the _query is initialized or not.
      2. Adding _stopping check to the stop() method to make sure that the stop operation will be called only once.

      Attachments

        Issue Links

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

          Activity

            People

              pasin Pasin Suriyentrakorn
              pasin Pasin Suriyentrakorn
              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