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.



    • Bug
    • Resolution: Fixed
    • Test Blocker
    • 3.0.0
    • 3.0.0-beta2
    • 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


      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]


        Issue Links

          For Gerrit Dashboard: CCBC-1148
          # Subject Branch Project Status CR V



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



                Gerrit Reviews

                  There are no open Gerrit changes