Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-2132

segfault when calling mongo::ScopedDbConnection::getScopedDbConnection

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • 01112017-cleanup
    • None
    • None

    Description

      calling to mongo::ScopedDbConnection::getScopedDbConnection leads to SIGSEGV signal.

      Example code:

      #include <iostream>

      #include "mongo/client/dbclient.h"
      #include "mongo/client/connpool.h"

      int main()
      {
      std::string const db = "rs0/127.0.0.1:27017";

      try {
      boost::scoped_ptr<mongo::ScopedDbConnection> conn(
      mongo::ScopedDbConnection::getScopedDbConnection(db));
      if (conn->get() == nullptr)

      { std::cerr << "Unable to connect to database\n"; }

      else

      { std::cerr << "Connection established\n"; }

      }
      catch (std::exception const& e)

      { std::cerr << e.what() << std::endl; }

      catch (...)

      { std::cerr << "Unhandled exception" << std::endl; }

      return 0;
      }

      compile in Debug mode with g++

      Reporter: ag
      E-mail: ag.tsure@gmail.com

      Attachments

        Activity

          People

            Unassigned Unassigned
            auto auto
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10 years, 16 weeks, 1 day ago