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

Race condition on SharedKeys causes silent error



    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.6.0
    • 2.6.0
    • LiteCore
    • Security Level: Public


      This is quite hard to figure out, but about 6-7% of the time on .NET tests a race condition in LiteCore is triggered in the way that shared keys are persisted to the database. Without adding additional logging this was causing weird behavior due to silent errors and failure but what is happening is the following.

      1. Race on shared keys causes the keyString() method to mistakenly return null due to "unknown key"
      2. The JSON Encoder is fine with encoding a number as a key into a JSON document
      3. This gets transmitted to the other side via passive pusher to active puller
      4. The Fleece encode fails due to invalid keys (integers) being present
      5. The document is skipped due to this error and an innocuous document ended callback with a 0 error code is sent

      This took a long time to diagnose since it manifested as failure to call conflict resolvers (which makes sense since the document never gets properly saved). This most likely happened during the DBWorker refactor.


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


          jimb Jim Borden created issue -
          jimb Jim Borden made changes -
          Field Original Value New Value
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          jimb Jim Borden made changes -
          Actual End 2019-06-14 16:50 (issue has been resolved)
          jimb Jim Borden made changes -
          Status Resolved [ 5 ] Closed [ 6 ]


            jimb Jim Borden
            jimb Jim Borden
            0 Vote for this issue
            1 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes