Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1046

Segfault in C++ driver when using boost::program_options in our own project

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.4.1
    • Component/s: Internal Client
    • Labels:
      None
    • Environment:
      Linux 2.6.18-164.15.1.el5 #1 SMP Wed Mar 17 11:30:06 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
      Boost 1.40

      We are in the process of upgrading our MongoDB clients from 1.0.0 to 1.4.1, and started getting segfaults when using the ScopedDbConnection. Eventually I found out it had to do with boost::program_options ,- see attachment for reproducible test case.

      Output on my machine:

      $ ./test 172.16.1.12,172.16.1.15
      1
      2
      3
      1
      Segmentation fault (core dumped)

      (gdb) thread apply all bt

      Thread 2 (process 8803):
      #0 0x0000003d8380dfe1 in nanosleep () from /lib64/libpthread.so.0
      #1 0x0000000000480534 in mongo::BackgroundJob::go (this=0x7fff69f072f0) at ./util/goodies.h:225
      #2 0x0000000000479312 in mongo::MessagingPort::connect (this=0x1d9f7c80, _far=<value optimized out>) at util/message.cpp:230
      #3 0x000000000045dbf1 in mongo::DBClientConnection::connect (this=0x1d9f7bd0, _serverAddress=<value optimized out>, errmsg=@0x7fff69f075f0) at client/dbclient.cpp:464
      #4 0x000000000045df0d in mongo::DBClientPaired::connect (this=0x1d9f7af0, serverHostname1=<value optimized out>, serverHostname2=@0x7fff69f07630) at client/dbclient.cpp:944
      #5 0x000000000045e035 in mongo::DBClientPaired::connect (this=0x1d9f7af0, hostpairstring=@0x7fff69f077b0) at client/dbclient.cpp:960
      #6 0x0000000000452922 in mongo::DBConnectionPool::get (this=0x6a5180, host=@0x7fff69f07a30) at client/connpool.cpp:54
      #7 0x000000000041a69e in ScopedDbConnection (this=0x7fff69f079b0, _host=@0x7fff69f07a30) at /opt/mongodb/include/mongo/client/connpool.h:95
      #8 0x00000000004137da in main (argc=2, argv=0x7fff69f07b58) at testcase.cpp:43

      Thread 1 (process 8809):
      #0 0x00002b9e3362709e in tls_destructor () from /usr/local/lib/libboost_thread.so.1.40.0
      #1 0x00002b9e33627203 in thread_proxy () from /usr/local/lib/libboost_thread.so.1.40.0
      #2 0x0000003d83806617 in start_thread () from /lib64/libpthread.so.0
      #3 0x0000003d830d3c2d in clone () from /lib64/libc.so.6
      (gdb)

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            solatis Leon Mergen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: