Details
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
- causes
-
JSCBC-640 Fix collections testing and behaviour
-
- Resolved
-
For Gerrit Dashboard: CCBC-1148 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
119984,6 | CCBC-1148: Fix error handling when resolving collections | master | libcouchbase | Status: MERGED | +2 | +1 |
120073,3 | CCBC-1148: Add NULL checks for enhanced error info | master | libcouchbase | Status: MERGED | +2 | +1 |