Details

    • Task
    • Resolution: Fixed
    • Major
    • 2.8.4
    • None
    • None
    • None

    Description

      Calling lcb_health with cmd.id set results in an assertion being thrown in lcb_json.cpp:

      thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
        * frame #0: 0x00007fffdb28cd42 libsystem_kernel.dylib`__pthread_kill + 10
          frame #1: 0x00007fffdb37a457 libsystem_pthread.dylib`pthread_kill + 90
          frame #2: 0x00007fffdb1f2420 libsystem_c.dylib`abort + 129
          frame #3: 0x00007fffdb1b9893 libsystem_c.dylib`__assert_rtn + 320
          frame #4: 0x000000010541389e libcouchbase.2.dylib`Json::throwLogicError((null)="in Json::Value::operator[](ArrayIndex): requires arrayValue") at lcb-jsoncpp.cpp:2362
          frame #5: 0x0000000105420087 libcouchbase.2.dylib`Json::Value::operator[](this=0x0000000101203240, index=0) at lcb-jsoncpp.cpp:3089
          frame #6: 0x0000000105426473 libcouchbase.2.dylib`Json::Value::append(this=0x0000000101203240, value=0x00007fff5fbfb6d0) at lcb-jsoncpp.cpp:3233
          frame #7: 0x00000001053cd2a4 libcouchbase.2.dylib`::lcb_health(instance=0x00000001013ec350, cookie=0x00000001063427c8, cmd=0x00007fff5fbfbc60) at ping.cc:389
          frame #8: 0x00000001052be56c _libcouchbase.cpython-36m-darwin.so`pycbc_Bucket__get_health(self=0x000000010612dd90, args=<unavailable>, kwargs=<unavailable>) at miscops.c:421 [opt]
          frame #9: 0x00000001000d17ea Python`_PyCFunction_FastCallDict + 463
          frame #10: 0x000000010013600f Python`call_function + 489
          frame #11: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #12: 0x0000000100137166 Python`_PyFunction_FastCall + 121
          frame #13: 0x0000000100135fe6 Python`call_function + 448
          frame #14: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #15: 0x0000000100137166 Python`_PyFunction_FastCall + 121
          frame #16: 0x0000000100135fe6 Python`call_function + 448
          frame #17: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #18: 0x00000001001367df Python`_PyEval_EvalCodeWithName + 1829
          frame #19: 0x0000000100137096 Python`_PyFunction_FastCallDict + 444
          frame #20: 0x0000000100099ab9 Python`_PyObject_FastCallDict + 196
          frame #21: 0x0000000100099bdc Python`_PyObject_Call_Prepend + 156
          frame #22: 0x000000010009993a Python`PyObject_Call + 101
          frame #23: 0x000000010012f121 Python`_PyEval_EvalFrameDefault + 5527
          frame #24: 0x00000001001367df Python`_PyEval_EvalCodeWithName + 1829
          frame #25: 0x0000000100137096 Python`_PyFunction_FastCallDict + 444
          frame #26: 0x0000000100099ab9 Python`_PyObject_FastCallDict + 196
          frame #27: 0x0000000100099bdc Python`_PyObject_Call_Prepend + 156
          frame #28: 0x000000010009993a Python`PyObject_Call + 101
          frame #29: 0x00000001000e3fce Python`slot_tp_call + 50
          frame #30: 0x0000000100099a84 Python`_PyObject_FastCallDict + 143
          frame #31: 0x0000000100135fdf Python`call_function + 441
          frame #32: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #33: 0x0000000100137166 Python`_PyFunction_FastCall + 121
          frame #34: 0x0000000100135fe6 Python`call_function + 448
          frame #35: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #36: 0x0000000100137166 Python`_PyFunction_FastCall + 121
          frame #37: 0x0000000100099ab9 Python`_PyObject_FastCallDict + 196
          frame #38: 0x0000000100099bdc Python`_PyObject_Call_Prepend + 156
          frame #39: 0x000000010009993a Python`PyObject_Call + 101
          frame #40: 0x000000010012f121 Python`_PyEval_EvalFrameDefault + 5527
          frame #41: 0x00000001001367df Python`_PyEval_EvalCodeWithName + 1829
          frame #42: 0x0000000100137096 Python`_PyFunction_FastCallDict + 444
          frame #43: 0x0000000100099ab9 Python`_PyObject_FastCallDict + 196
          frame #44: 0x0000000100099bdc Python`_PyObject_Call_Prepend + 156
          frame #45: 0x000000010009993a Python`PyObject_Call + 101
          frame #46: 0x00000001000e3fce Python`slot_tp_call + 50
          frame #47: 0x0000000100099a84 Python`_PyObject_FastCallDict + 143
          frame #48: 0x0000000100135fdf Python`call_function + 441
          frame #49: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #50: 0x0000000100137166 Python`_PyFunction_FastCall + 121
          frame #51: 0x0000000100099ab9 Python`_PyObject_FastCallDict + 196
          frame #52: 0x0000000100099bdc Python`_PyObject_Call_Prepend + 156
          frame #53: 0x000000010009993a Python`PyObject_Call + 101
          frame #54: 0x000000010012f121 Python`_PyEval_EvalFrameDefault + 5527
          frame #55: 0x00000001001367df Python`_PyEval_EvalCodeWithName + 1829
          frame #56: 0x0000000100137096 Python`_PyFunction_FastCallDict + 444
          frame #57: 0x0000000100099ab9 Python`_PyObject_FastCallDict + 196
          frame #58: 0x0000000100099bdc Python`_PyObject_Call_Prepend + 156
          frame #59: 0x000000010009993a Python`PyObject_Call + 101
          frame #60: 0x00000001000e3fce Python`slot_tp_call + 50
          frame #61: 0x0000000100099a84 Python`_PyObject_FastCallDict + 143
          frame #62: 0x0000000100135fdf Python`call_function + 441
          frame #63: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #64: 0x0000000100137166 Python`_PyFunction_FastCall + 121
          frame #65: 0x0000000100099ab9 Python`_PyObject_FastCallDict + 196
          frame #66: 0x0000000100099bdc Python`_PyObject_Call_Prepend + 156
          frame #67: 0x000000010009993a Python`PyObject_Call + 101
          frame #68: 0x000000010012f121 Python`_PyEval_EvalFrameDefault + 5527
          frame #69: 0x00000001001367df Python`_PyEval_EvalCodeWithName + 1829
          frame #70: 0x0000000100137096 Python`_PyFunction_FastCallDict + 444
          frame #71: 0x0000000100099ab9 Python`_PyObject_FastCallDict + 196
          frame #72: 0x0000000100099bdc Python`_PyObject_Call_Prepend + 156
          frame #73: 0x000000010009993a Python`PyObject_Call + 101
          frame #74: 0x00000001000e3fce Python`slot_tp_call + 50
          frame #75: 0x0000000100099a84 Python`_PyObject_FastCallDict + 143
          frame #76: 0x0000000100135fdf Python`call_function + 441
          frame #77: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #78: 0x0000000100137166 Python`_PyFunction_FastCall + 121
          frame #79: 0x0000000100099ab9 Python`_PyObject_FastCallDict + 196
          frame #80: 0x0000000100099bdc Python`_PyObject_Call_Prepend + 156
          frame #81: 0x000000010009993a Python`PyObject_Call + 101
          frame #82: 0x000000010012f121 Python`_PyEval_EvalFrameDefault + 5527
          frame #83: 0x00000001001367df Python`_PyEval_EvalCodeWithName + 1829
          frame #84: 0x0000000100137096 Python`_PyFunction_FastCallDict + 444
          frame #85: 0x0000000100099ab9 Python`_PyObject_FastCallDict + 196
          frame #86: 0x0000000100099bdc Python`_PyObject_Call_Prepend + 156
          frame #87: 0x000000010009993a Python`PyObject_Call + 101
          frame #88: 0x00000001000e3fce Python`slot_tp_call + 50
          frame #89: 0x0000000100099a84 Python`_PyObject_FastCallDict + 143
          frame #90: 0x0000000100135fdf Python`call_function + 441
          frame #91: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #92: 0x0000000100137166 Python`_PyFunction_FastCall + 121
          frame #93: 0x0000000100135fe6 Python`call_function + 448
          frame #94: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #95: 0x0000000100137166 Python`_PyFunction_FastCall + 121
          frame #96: 0x0000000100135fe6 Python`call_function + 448
          frame #97: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #98: 0x00000001001367df Python`_PyEval_EvalCodeWithName + 1829
          frame #99: 0x000000010012db4f Python`PyEval_EvalCodeEx + 52
          frame #100: 0x00000001000b9c1b Python`function_call + 338
          frame #101: 0x000000010009993a Python`PyObject_Call + 101
          frame #102: 0x000000010012f121 Python`_PyEval_EvalFrameDefault + 5527
          frame #103: 0x00000001001367df Python`_PyEval_EvalCodeWithName + 1829
          frame #104: 0x0000000100137096 Python`_PyFunction_FastCallDict + 444
          frame #105: 0x0000000100099ab9 Python`_PyObject_FastCallDict + 196
          frame #106: 0x0000000100099bdc Python`_PyObject_Call_Prepend + 156
          frame #107: 0x000000010009993a Python`PyObject_Call + 101
          frame #108: 0x00000001000e48fa Python`slot_tp_init + 57
          frame #109: 0x00000001000e1846 Python`type_call + 184
          frame #110: 0x0000000100099a84 Python`_PyObject_FastCallDict + 143
          frame #111: 0x0000000100135fdf Python`call_function + 441
          frame #112: 0x000000010012eecc Python`_PyEval_EvalFrameDefault + 4930
          frame #113: 0x00000001001367df Python`_PyEval_EvalCodeWithName + 1829
          frame #114: 0x000000010012db15 Python`PyEval_EvalCode + 43
          frame #115: 0x000000010015525a Python`run_mod + 54
          frame #116: 0x000000010015553a Python`PyRun_FileExFlags + 180
          frame #117: 0x0000000100154ac7 Python`PyRun_SimpleFileExFlags + 280
          frame #118: 0x0000000100168878 Python`Py_Main + 3268
          frame #119: 0x0000000100001e1d python`___lldb_unnamed_symbol1$$python + 227
          frame #120: 0x00007fffdb15e235 libdyld.dylib`start + 1
          frame #121: 0x00007fffdb15e235 libdyld.dylib`start + 1

       

      3088	Value& Value::operator[](ArrayIndex index) {
      -> 3089	  JSON_ASSERT_MESSAGE(
         3090	      type_ == nullValue || type_ == arrayValue,
         3091	      "in Json::Value::operator[](ArrayIndex): requires arrayValue"); 

       

      This appears to be because lcb_health is attempting to append a string to a string:

         386         snprintf(id, sizeof(id), "%p", (void *)instance);
         387         root["id"] = id;
         388         if (cmd->id) {
      -> 389             root["id"].append("/").append(cmd->id);
         390         }
         391     }
         392 

       Json::append only works on Null or Array type nodes, i.e. it is for adding to/creating Json arrays, not appending strings. It looks like another method should be adopted for this - perhaps building the string first, before assigning it to the Json object member.

      Attachments

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

        Activity

          People

            avsej Sergey Avseyev
            Ellis.Breen Ellis Breen
            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