Uploaded image for project: 'Couchbase C client library libcouchbase'
  1. Couchbase C client library libcouchbase
  2. CCBC-1148

Collections packet encoding appears malformed, and error contexts broken.

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Test Blocker
    • Resolution: Fixed
    • 3.0.0-beta2
    • 3.0.0
    • library
    • None
    • Couchbase Server 6.5.0-4960 (on Ubuntu 18.04 LTS)
      libcouchbase 3.0.0-beta.2 (150aa4a, on OS X)
    • 1
    • SDK1: GA and Priority List

    Description

      When enabling collections in the Node.js SDK, a segmentation fault is observed.  Upon investigation of the fault, a number of issues appeared to be contributing to this.

      The first is that libcouchbase appears to be generating an invalid packet to the cluster in spite of correct inputs.  The cluster is brand new with the only modifications being that a default bucket is created, and developer preview options are enabled.  I have attached a wireshark capture where the malformed packets are visible at the end (note that
      lcb_cmdstore_collection is being invoked with `NULL, 0, "test", 4`, lcb_cmdstore_key with `"f77b7b40_6", 10` and lcb_cmdstore_value with `..., 136`. Note that the incorrectly generated packet is actually proceeded by a completely different issue where the server appears to be returning ERR_INVALID_ARGUMENTS to a GET_COLLECTION_ID request (which might be the root cause of the SDK generating an invalid STORE packet).
       
      In addition to this, the SDK appears to be incorrectly specifying some parts of the error context when this error occurs which is causing a segmentation fault when the sdk attempts to generate error context information on the wrapper side.  Here is the relevant portion of the backtrace:

      * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
        * frame #0: 0x00007fff7436f232 libsystem_c.dylib`strlen + 18
          frame #1: 0x0000000104ad49e6 couchbase_impl.node`::lcb_respstore_error_context(resp=0x00007ffeefbf6f10, ctx=0x00007ffeefbf6e30) at store.cc:40 [opt]
          frame #2: 0x0000000104a880f9 couchbase_impl.node`v8::Local<v8::Value> couchnode::RespReader<lcb_RESPSTORE_, &(lcb_respstore_cookie)>::decodeError<&(lcb_respstore_error_context)>(lcb_STATUS) const at respreader.h:18 [opt]
      

      Attachments

        Issue Links

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

          Activity

            Build libcouchbase-2.8.5-588 contains libcouchbase commit ebf3e5c with commit message:
            CCBC-1148: Fix error handling when resolving collections

            build-team Couchbase Build Team added a comment - Build libcouchbase-2.8.5-588 contains libcouchbase commit ebf3e5c with commit message: CCBC-1148 : Fix error handling when resolving collections

            Build libcouchbase-2.8.5-588 contains libcouchbase commit 079eaab with commit message:
            CCBC-1148: Add NULL checks for enhanced error info

            build-team Couchbase Build Team added a comment - Build libcouchbase-2.8.5-588 contains libcouchbase commit 079eaab with commit message: CCBC-1148 : Add NULL checks for enhanced error info

            Build couchbase-server-7.0.0-3115 contains libcouchbase commit ebf3e5c with commit message:
            CCBC-1148: Fix error handling when resolving collections

            build-team Couchbase Build Team added a comment - Build couchbase-server-7.0.0-3115 contains libcouchbase commit ebf3e5c with commit message: CCBC-1148 : Fix error handling when resolving collections

            Build couchbase-server-7.0.0-3115 contains libcouchbase commit 079eaab with commit message:
            CCBC-1148: Add NULL checks for enhanced error info

            build-team Couchbase Build Team added a comment - Build couchbase-server-7.0.0-3115 contains libcouchbase commit 079eaab with commit message: CCBC-1148 : Add NULL checks for enhanced error info

            People

              avsej Sergey Avseyev
              brett19 Brett Lawson
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty