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

mongocxx::client constructor fails on Windows 7

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 3.0.3
    • Fix Version/s: None
    • Component/s: Portability
    • Labels:
      None
    • Environment:
      Windows 7, 32 bit binary, 64 bit OS

      Description

      Basically, if I try to use the simple mongo client data structure listed in the tutorial, I get a hard crash in Windows 7.

      This is my fully-contained working example that demonstrates the issue:
      ```
      #include <cstdint>
      #include <iostream>
      #include <vector>

      #include <bsoncxx/json.hpp>
      #include <mongocxx/client.hpp>
      #include <mongocxx/stdx.hpp>
      #include <mongocxx/uri.hpp>

      using bsoncxx::builder::stream::close_array;
      using bsoncxx::builder::stream::close_document;
      using bsoncxx::builder::stream::document;
      using bsoncxx::builder::stream::finalize;
      using bsoncxx::builder::stream::open_array;
      using bsoncxx::builder::stream::open_document;

      int main(void)
      {
      try {

      mongocxx::uri uri("mongodb://localhost:27017");
      // this is what's failing
      mongocxx::client client

      { uri }

      ;
      }
      catch (std::exception err)

      { std::cout << err.what() << "\n"; }

      return 0;
      }
      ```

      It seems like it's an issue deep in the Mongo callstack:
      > libmongoc-1.0.dll!_InterlockedExchangeAdd64(volatile __int64 * Addend, __int64 Value) Line 5603 C

      Namely, this line here:
      ```
      do

      { // this one is what VS picks up on Old = *Addend; }

      while (InterlockedCompareExchange64(Addend,
      Old + Value,
      Old) != Old);
      ```

      I installed the mongo-cxx-driver using vcpkg as well.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: