Details
-
Bug
-
Resolution: Incomplete
-
Major - P3
-
None
-
legacy-1.0.3, legacy-1.0.7
Description
Hi All,
Since updating from 2.x to 3.x, we've experienced significant difficultly with the new client driver requiring the explicit calls to mongo::client::initialize and mongo::client::shutdown, with a fatal infinite wait in the replica set monitor watcher if mongo::client::shutdown is not called explicitly.
We use Mongo in a shared library (dll) that is consumed by a number of clients, and in this scenario it's not straightforward to call mongo::client::shutdown from the parent executable. When the executable dies and the mongo wrapper DLL unloads, the mongo client driver's threads are terminated before the destructor for the replica set monitor watcher is called. When its destructor is called, it waits on a condition variable that will never be set, as the thread is already gone.
There are several possible workarounds and refactoring that could happen in the client driver.
But the main question is what's the best practice for wrapping the new Mongo driver in a dll used by a number of consumers? The current driver implementation makes this difficult if not impossible, so any advice would be appreciated.
An example app package is attached showing an exe calling a dll containing Mongo functionality.
Thank you kindly in advance,
Steve A.