[Mongo-cxx-driver.r3.6.0] using std::string on mongocxx::uri leading to crash


after facing an issue with the driver crashing during an iterative read/write process, I wanted to try the upgrade from 3.5.0 to 3.6.0. Compilation was no big deal after figuring out howto do it at the last time. I’m still using Boost (1.72.0) for the Polyfill even if I use VS2017 for my application.

After switching to 3.6.0 I was not able to connect to the DB nor even create an mongocxx::uri by passing a const std::string. Also taking the detour by creating a bsoncxx::string::view_or_value first does not help. After passing the c-String from my string object, the uri constructor was not throwing any longer but then creating a mongocxx::pool was causing the trouble. From then, the passed string was no longer a undefined object. There I stopped further investigations and went back to 3.5.0.

I’m actually also struggeling by catching exceptions, but I’m sure this is another topic. I’m also pretty sure, that the crashing behaviour is linked to some weird unmatching VS compiling setting or sth.

Very thankful for all kind of hints

Hi @Uwe_Dittus,

Unfortunately I’m unable to reproduce the issue that you’re seeing. The following code snippet works without an issue in both v3.5.x and v3.6.x

mongocxx::instance instance{};
mongocxx::uri uri("mongodb://MONGODB_URI/");
auto client = mongocxx::client{uri};

If you’re able to reproduce the issue consistently, could you provide the following:

  • Minimal code example that able to reproduce the issue
  • Full stack trace error (or compilation error?)

Also could you elaborate what do you mean by mongocxx::pool causing trouble ?


Hi @wan,

thanks for the answer. I’ll try it again next week, just too busy.


1 Like

Just stumbled over this again.
For those who wondering. It was a simple VisualStudio Project config issue. The debug version of my application was not compiled with the /MDd flag.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.