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

Race condition on SharedKeys causes silent error

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

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

        Activity

          People

            jimb Jim Borden
            jimb Jim Borden
            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