Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1780

program crashes on cursor.begin()

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.0
    • Component/s: None
    • None
    • Environment:
      mongodb version: 3.6
      mongo-c-driver version: 3.14

      My program is trying to fetch records from manual_buckets collection. It crashes at the following point...

      (gdb) bt
      #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #1 0x00007f267af40801 in __GI_abort () at abort.c:79
      #2 0x00007f2677fd9332 in mongoc_socket_errno (sock=<optimized out>)
      at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-socket.c:594
      #3 0x00007f2677fdc6ec in _mongoc_stream_socket_readv (stream=0x5605fc50b790, iov=0x7f266b7b4d10, iovcnt=1, min_bytes=351, timeout_msec=<optimized out>)
      at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-stream-socket.c:164
      #4 0x00007f2677fdaea3 in mongoc_stream_read (stream=stream@entry=0x5605fc50b790, buf=<optimized out>, count=count@entry=351, min_bytes=min_bytes@entry=351,
      timeout_msec=<optimized out>) at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-stream.c:281
      #5 0x00007f2677fa6371 in _mongoc_buffer_append_from_stream (buffer=buffer@entry=0x7f266b7b4df0, stream=0x5605fc50b790, size=351,
      timeout_msec=<optimized out>, error=error@entry=0x7f266b7b5580)
      at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-buffer.c:212
      #6 0x00007f2677fae7b6 in mongoc_cluster_run_opmsg (cluster=cluster@entry=0x5605fc96a028, cmd=cmd@entry=0x7f266b7b5780, reply=reply@entry=0x7f266b7b5080,
      error=error@entry=0x7f266b7b5580) at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-cluster.c:2861
      #7 0x00007f2677faf5fe in mongoc_cluster_run_command_private (cluster=cluster@entry=0x5605fc96a028, cmd=cmd@entry=0x7f266b7b5780, reply=0x7f266b7b5080,
      reply@entry=0x0, error=error@entry=0x7f266b7b5580) at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-cluster.c:649
      #8 0x00007f2677faf6c4 in mongoc_cluster_run_command_parts (cluster=0x5605fc96a028, server_stream=<optimized out>, parts=0x7f266b7b5780, reply=0x0,
      error=0x7f266b7b5580) at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-cluster.c:700
      #9 0x00007f2677fb1ae8 in mongoc_cluster_check_interval (cluster=cluster@entry=0x5605fc96a028, server_id=server_id@entry=1)
      at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-cluster.c:2455
      #10 0x00007f2677fb1c2a in _mongoc_cluster_stream_for_optype (cluster=0x5605fc96a028, optype=optype@entry=MONGOC_SS_READ, read_prefs=0x7f2630003720, cs=0x0,
      reply=reply@entry=0x7f266b7b5c80, error=0x7f26300033d0) at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-cluster.c:2169
      #11 0x00007f2677fb1cd5 in mongoc_cluster_stream_for_reads (cluster=<optimized out>, read_prefs=<optimized out>, cs=<optimized out>,
      reply=reply@entry=0x7f266b7b5c80, error=<optimized out>) at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-cluster.c:2219
      #12 0x00007f2677fba6ff in _mongoc_cursor_fetch_stream (cursor=cursor@entry=0x7f2630003210)
      at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-cursor.c:658
      #13 0x00007f2677fbd533 in _prime (cursor=0x7f2630003210) at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-cursor-find.c:40
      #14 0x00007f2677fbb3d1 in _call_transition (cursor=0x7f2630003210)
      at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-cursor.c:1150
      #15 mongoc_cursor_next (cursor=0x7f2630003210, bson=0x7f266b7b5e60)
      at /root/mongo-c-driver/mongo-c-driver-1.14.0/src/libmongoc/src/mongoc/mongoc-cursor.c:1226
      #16 0x00007f267baee7d2 in mongocxx::v_noabi::cursor::iterator::operator++() () from /usr/local/lib/libmongocxx.so._noabi
      #17 0x00007f267baee9e3 in mongocxx::v_noabi::cursor::begin() () from /usr/local/lib/libmongocxx.so._noabi
      #18 0x00005605fa5258ba in MongoDB::loadCollection (this=0x5605fc218be8, loader=..., bucket="buk")

       

      ((gdb) frame 18

      #18 0x00005605fa5258ba in MongoDB::loadCollection (this=0x5605fc218be8, loader=..., bucket="buk")    at  /src/db/mongodbsrc.cpp:252

      252             for (auto&& doc: cursor)

       

      It's a multithreaded environment with different thread pulling records from different collections.

      When I ran the piece of code for pulling the records from manual_buckets, it just runs fine. 

       

      Also I am getting following erros sometimes...

      [2019-05-30 11:32:16,357] FATAL Error: Failed to send "find" command with database "db": Malformed message from server: generic server error

       

      Please help me.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            mkansari Mohammed Khalid Ansari
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: