-
Type:
Bug
-
Resolution: Cannot Reproduce
-
Priority:
Critical - P2
-
None
-
Affects Version/s: 1.12.0
-
Component/s: None
-
None
-
Environment:Ubuntu 16 64 bit
-
None
-
None
-
None
-
None
-
None
-
None
-
None
We have an application which writes records to a remote MongoDB. On observing connection loss to the remote, we destroy the mongo client and create a new one only the remote connection is established back.
Sometime on connection loss I see below crash:
Thread 1 (Thread 0x7fbd181bfac0 (LWP 10006)): #0 0x00007fbcda37761a in mongoc_stream_get_root_stream () from /usr/lib/libmongoc-1.0.so.0 #1 0x00007fbcda37772f in mongoc_stream_poll () from /usr/lib/libmongoc-1.0.so.0 #2 0x00007fbcda32f626 in mongoc_async_run () from /usr/lib/libmongoc-1.0.so.0 #3 0x00007fbcda38029d in mongoc_topology_scanner_work () from /usr/lib/libmongoc-1.0.so.0 #4 0x00007fbcda379c07 in mongoc_topology_scan_once () from /usr/lib/libmongoc-1.0.so.0 #5 0x00007fbcda379c93 in _mongoc_topology_do_blocking_scan () from /usr/lib/libmongoc-1.0.so.0 #6 0x00007fbcda37a21d in mongoc_topology_select_server_id () from /usr/lib/libmongoc-1.0.so.0 #7 0x00007fbcda33aae4 in _mongoc_client_end_sessions () from /usr/lib/libmongoc-1.0.so.0 #8 0x00007fbcda337353 in mongoc_client_destroy () from /usr/lib/libmongoc-1.0.so.0 #9 0x00007fbcdb3d3bfb in MongoClientOps::destroy_client (this=0x2b456f8) at /localdisk/jenkins-j5-ssh1/spot_debug__ub16/rel_6.1.1c/systemtest/modules/core/rwvx/rwlog/rwlogd/sinkapi/plugin/rwlogd_eventsdb_sink/mongo_client_ops.cpp:294 #10 0x00007fbcdb3c67c6 in EventsDBHASink::stop_sending_events (this=0x2b455f0) at /localdisk/jenkins-j5-ssh1/spot_debug__ub16/rel_6.1.1c/systemtest/modules/core/rwvx/rwlog/rwlogd/sinkapi/plugin/rwlogd_eventsdb_sink/rwlogd_eventsdb_ha_sink.cpp:124
The code for destroying the client is:
void MongoClientOps::destroy_client()
{
RWMEMLOG (get_memlog_ptr(), RWMEMLOG_MEM2, "Destroy client connection");
if (bulk_) {
// Destroys mongo bulk in the destructor
delete bulk_;
bulk_ = nullptr;
}
//collection should be destroyed with the client
if (collection_) {
mongoc_collection_destroy(collection_);
collection_ = nullptr;
}
if (database_) {
mongoc_database_destroy(database_);
database_ = nullptr;
}
if (client_) {
mongoc_client_destroy(client_);
client_ = nullptr;
}
return;
}
Is there something wrong with my destroy sequence ?