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

_mongoc_handshake_build_doc_with_application core dumps with strlen call

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.14.0, 1.15.0, 1.16.2, 1.17.0-beta
    • Component/s: bsd, libmongoc
    • None
    • Environment:
      Openbsd 6.6. driver 1.16.2

      Hi,

      i migrated to 1.16.2 (with MongoDB 3.2) from very very old 1.0.2 release (was MongoDB 2.6). Im using driver for years with the simple setup, so i completed migration with no changes in mongoc snippets at all. The build is compiled from the sources with cmake / gcc, with no additional cmake options.

      And as far as i run new build ive got my application core dump.

      it is when i call mongoc_collection_remove() or mongoc_collection_insert() and this does not always happens. With the same query it may dumped or may not, and crashes about once out of ten times.

       

      gdb trace here

      #0 strlen () at /usr/src/lib/libc/arch/amd64/string/strlen.S:125
      #1 0x000001ccf0f4db22 in _mongoc_handshake_build_doc_with_application () from /usr/local/lib/libmongoc-1.0.so.0.0
      #2 0x000001ccf0f816d1 in _build_ismaster_with_handshake () from /usr/local/lib/libmongoc-1.0.so.0.0
      #3 0x000001ccf0f815af in _mongoc_topology_scanner_get_ismaster () from /usr/local/lib/libmongoc-1.0.so.0.0
      #4 0x000001ccf0f82c08 in _begin_ismaster_cmd () from /usr/local/lib/libmongoc-1.0.so.0.0
      #5 0x000001ccf0f82a7d in mongoc_topology_scanner_node_setup_tcp () from /usr/local/lib/libmongoc-1.0.so.0.0
      #6 0x000001ccf0f82203 in mongoc_topology_scanner_node_setup () from /usr/local/lib/libmongoc-1.0.so.0.0
      #7 0x000001ccf0f8336b in mongoc_topology_scanner_start () from /usr/local/lib/libmongoc-1.0.so.0.0
      #8 0x000001ccf0f7b2dc in mongoc_topology_scan_once () from /usr/local/lib/libmongoc-1.0.so.0.0
      #9 0x000001ccf0f7b244 in _mongoc_topology_do_blocking_scan () from /usr/local/lib/libmongoc-1.0.so.0.0
      #10 0x000001ccf0f7b88c in mongoc_topology_select_server_id () from /usr/local/lib/libmongoc-1.0.so.0.0
      #11 0x000001ccf0f290c0 in _mongoc_cluster_select_server_id () from /usr/local/lib/libmongoc-1.0.so.0.0
      #12 0x000001ccf0f24f14 in _mongoc_cluster_stream_for_optype () from /usr/local/lib/libmongoc-1.0.so.0.0
      #13 0x000001ccf0f25029 in mongoc_cluster_stream_for_writes () from /usr/local/lib/libmongoc-1.0.so.0.0
      #14 0x000001ccf0f2e2ad in _mongoc_collection_write_command_execute () from /usr/local/lib/libmongoc-1.0.so.0.0
      #15 0x000001ccf0f30785 in mongoc_collection_remove () from /usr/local/lib/libmongoc-1.0.so.0.0

       

      gcc -v
      Reading specs from /usr/lib/gcc-lib/amd64-unknown-openbsd6.6/4.2.1/specs
      Target: amd64-unknown-openbsd6.6
      Configured with: OpenBSD/amd64 system compiler
      Thread model: posix
      gcc version 4.2.1 20070719

      CVS to this strlen

      https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/arch/amd64/string/strlen.S?rev=1.8&content-type=text/plain

       

      PS: im new here, so i could missing something in rules. youre welcome to ask me.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            asuwish.def@gmail.com Sergey Baranov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: