[SERVER-6922] ReplicaSetMonitor should clean itself up (after stopping ReplicaSetMonitorWatcher) while program terminates Created: 03/Sep/12  Updated: 15/Feb/13  Resolved: 01/Oct/12

Status: Closed
Project: Core Server
Component/s: Internal Client
Affects Version/s: 2.2.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Gregor Macadam Assignee: Unassigned
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-7006 mongo tools seg fault in 2.2.0 with r... Closed
is related to SERVER-7217 Provide a method for C++ driver clien... Closed
Operating System: ALL
Participants:

 Description   

When creating a ScopedDbConnection with a replica set initialiser there is assertion. See https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/m5HozQ8CzgY



 Comments   
Comment by Pieter Willem Jordaan [ 01/Oct/12 ]

Hi

mongo::dbexit(mongo::EXIT_CLEAN);

works.

Comment by Randolph Tan [ 01/Oct/12 ]

Hi,

Can you try adding:

mongo::dbexit(mongo::EXIT_CLEAN);

at the end, just before return 0?

Comment by Pieter Willem Jordaan [ 01/Oct/12 ]

I agree with this Jira. It makes debugging difficult because of the segfault. Till then I will use the workaround.

Comment by David Schneider [ 04/Sep/12 ]

To cleanup the ReplicaSetMonitor you have to call mongo::ReplicaSetMonitor::remove("set_name", true);
but the driver schould cleanup by it self or with a global shutdown function

Sample to reproduce the assertion

#include <mongo/client/dbclient.h>
 
int main()
{
  mongo::ScopedDbConnection* conn = mongo::ScopedDbConnection::getScopedDbConnection("foo/mongodb01:27118,mongodb01:27128,mongodb01:27138");
 
  boost::this_thread::sleep(boost::posix_time::millisec(100));
 
  conn->done();
  delete conn;
  conn = 0;
 
  // uncomment this to avoid the assertion
  // mongo::ReplicaSetMonitor::remove("foo", true);
 
  return 0;
}

Generated at Thu Feb 08 03:13:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.