Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-5584

Crash on executing find operation in mcd-rpc.c

    • C Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Summary

      A user on the forum reported a crash (failing BSON_ASSERT) while executing a find operation in mcd-rpc.c

      Forum Post 

      Details

      "Hi All, Recently I deployed application using libmongoc driver version 1.26.2. I see there is crash.

      especially while doing the find. Here is the GDB trace. Any leads appreciated.

      as per the GDB, its failing at assertion in the below file and line
      mongo-c-driver-1.26.2/src/libmongoc/src/mongoc/mcd-rpc.c
      uint32_t
      mcd_rpc_op_msg_get_flag_bits (const mcd_rpc_message *rpc)

      _

      { ASSERT_MCD_RPC_ACCESSOR_PRECONDITIONS; BSON_ASSERT (rpc->msg_header.op_code == MONGOC_OP_CODE_MSG); return rpc->op_msg.flag_bits; }

      "_

      Program terminated with signal SIGABRT, Aborted.
      #0 __GI_raise (sig=sig@entry=6) at …/sysdeps/unix/sysv/linux/raise.c:50
      50 …/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
      (gdb) bt
      #0 __GI_raise (sig=sig@entry=6) at …/sysdeps/unix/sysv/linux/raise.c:50
      #1 0x00007f6a6f534537 in __GI_abort () at abort.c:79
      #2 0x00007f6a6d3d263f in mcd_rpc_op_msg_get_flag_bits (rpc=rpc@entry=0x560b9cef1cd0) at /home/surendra.paddala/mongo-c-driver-1.26.2/src/libmongoc/src/mongoc/mcd-rpc.c:2156
      #3 0x00007f6a6d3e5d9a in _mongoc_cluster_run_opmsg_recv (cluster=cluster@entry=0x560b9cfcd498, cmd=cmd@entry=0x7fffd71be160, rpc=rpc@entry=0x560b9cef1cd0, reply=reply@entry=0x560b9cfd7770,
      error=error@entry=0x560b9cfdb260) at /home/surendra.paddala/mongo-c-driver-1.26.2/src/libmongoc/src/mongoc/mongoc-cluster.c:3716
      #4 0x00007f6a6d3e6006 in mongoc_cluster_run_opmsg (cluster=cluster@entry=0x560b9cfcd498, cmd=cmd@entry=0x7fffd71be160, reply=reply@entry=0x560b9cfd7770, error=error@entry=0x560b9cfdb260)
      at /home/surendra.paddala/mongo-c-driver-1.26.2/src/libmongoc/src/mongoc/mongoc-cluster.c:3795
      #5 0x00007f6a6d3e6643 in mongoc_cluster_run_command_monitored (cluster=0x560b9cfcd498, cmd=cmd@entry=0x7fffd71be160, reply=reply@entry=0x560b9cfd7770, error=error@entry=0x560b9cfdb260)
      at /home/surendra.paddala/mongo-c-driver-1.26.2/src/libmongoc/src/mongoc/mongoc-cluster.c:611
      #6 0x00007f6a6d3f62ec in _mongoc_cursor_run_command (cursor=cursor@entry=0x560b9cfdb180, command=command@entry=0x7fffd71be470, opts=opts@entry=0x560b9cfdb1a0, reply=reply@entry=0x560b9cfd7770,
      retry_prohibited=retry_prohibited@entry=false) at /home/surendra.paddala/mongo-c-driver-1.26.2/src/libmongoc/src/mongoc/mongoc-cursor.c:1090
      #7 0x00007f6a6d3f8c22 in _mongoc_cursor_response_refresh (cursor=cursor@entry=0x560b9cfdb180, command=command@entry=0x7fffd71be470, opts=opts@entry=0x560b9cfdb1a0, response=response@entry=0x560b9cfd7770)
      at /home/surendra.paddala/mongo-c-driver-1.26.2/src/libmongoc/src/mongoc/mongoc-cursor.c:1747
      #8 0x00007f6a6d3f9e49 in _prime (cursor=0x560b9cfdb180) at /home/surendra.paddala/mongo-c-driver-1.26.2/src/libmongoc/src/mongoc/mongoc-cursor-find-cmd.c:36
      #9 0x00007f6a6d3f696d in _call_transition (cursor=0x560b9cfdb180) at /home/surendra.paddala/mongo-c-driver-1.26.2/src/libmongoc/src/mongoc/mongoc-cursor.c:1256
      #10 mongoc_cursor_next (cursor=0x560b9cfdb180, bson=0x7fffd71be740) at /home/surendra.paddala/mongo-c-driver-1.26.2/src/libmongoc/src/mongoc/mongoc-cursor.c:1332
      #11 0x00007f6a6d4fc198 in db_mongodb_store_result (h=0x7f6a6d58a480, r=0x7fffd71be9e0) at mongodb_dbase.c:859
      #12 0x00007f6a6d4ff77f in db_mongodb_query (h=0x7f6a6d58a480, k=0x7fffd71be9d0, op=0x0, v=0x7fffd71be990, c=0x7fffd71be9f0, n=2, nc=1, o=0x0, _r=0x7fffd71be9e0) at mongodb_dbase.c:1073
      #13 0x00007f6a6ab60f30 in get_session_data (session_id=0x0, framed_ip_address=0x7f666cf92078) at pcc_data_load.c:3521
      #14 0x00007f6a6aa54960 in get_gx_session_from_db (session_id=0x0, framed_ip_address=0x7f666cf92078) at gx_controller_hash.c:154
      #15 0x00007f6a6aa66abb in is_gx_exist (framed_ip_address=0x7f666cf92078, session_id=0x7fffd71bee30) at gx_controller_hash.c:1133
      #16 0x00007f6a6aa26614 in process_rx_queue_message (msg=0x7f666cf91f50) at rx_controller_queue.c:101
      #17 0x00007f6a6aa2ad71 in rx_queue_process (id=133) at rx_controller_queue.c:402
      #18 0x00007f6a6aa02978 in child_init (rank=0) at mod.c:200
      #19 0x0000560b9ac3d052 in init_mod_child (m=0x7f6a6d577c50, rank=0) at core/sr_module.c:780
      #20 0x0000560b9ac3ccd0 in init_mod_child (m=0x7f6a6d577ee0, rank=0) at core/sr_module.c:776
      #21 0x0000560b9ac3ccd0 in init_mod_child (m=0x7f6a6d578300, rank=0) at core/sr_module.c:776
      #22 0x0000560b9ac3d817 in init_child (rank=0) at core/sr_module.c:825
      #23 0x0000560b9aa655ed in main_loop () at main.c:1753
      #24 0x0000560b9aa6d79a in main (argc=9, argv=0x7fffd71bf848) at main.c:2800
      

      Environment

      • C Driver version 1.26.2
      • MongoDB 6.x
      • OS: Debian 11

      Additional Background

      "firstly if the mongo DB server is dedicated, we really see no issues. When application get connected to cluster where replication enabled between two sites. Shard key based. On this server we experience the issue. Data is very simple. we have two collections. Store it and find using a key.
      write operations are no issue. Only with read(find query)"

       

            Assignee:
            ezra.chung@mongodb.com Ezra Chung
            Reporter:
            rishabh.bisht@mongodb.com Rishabh Bisht
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: