[SERVER-3522] Memory Leak in dbtests/perftests.cpp Created: 03/Aug/11  Updated: 12/Jul/16  Resolved: 07/Dec/11

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 2.1.0

Type: Bug Priority: Major - P3
Reporter: Sridhar Nanjundeswaran Assignee: Kevin Matulef
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

Issue based on post on GG

Sentry found a couple new memory leaks today, introduced here:
https://github.com/mongodb/mongo/commit/7c8cfd9
I know it's test code, but someone may be interested in cleaning it up anyway. In dbtests/perftests.cpp, around line 180:
DBClientConnection *c = new DBClientConnection(false, 0, 10);
string err;
if( c->connect("mongo05.10gen.cust.cbici.net", err) ) {
if( !c->auth("perf", "perf", pwd, err) )

{ cout << "info: authentication with stats db failed: " << err << endl; // XXX: c leaked on this path assert(false); }


conn = c;
}
else

{ cout << err << " (to log perfstats)" << endl; // XXX: c leaked on this path }


I've noted the two locations where the connection 'c' is leaked in the above code (goes out of scope without being reassigned or deleted). Again, not a big deal if these are short-lived tests, but worth fixing if the tests are resource intensive.



 Comments   
Comment by Christopher Sandulow [ 28/May/14 ]

akshay

FYI - Nessus still reporting on this; I am not sure what is using this database.

Version     : 2.2.1
  Git version : d6764bf8dfe0685521b8bc7b98fd1fab8cfeb5ae
Port	Hosts
27017 / tcp / mongodb	
mongo05.10gen.cust.cbici.net

Comment by auto [ 02/Dec/11 ]

Author:

{u'login': u'matulef', u'name': u'Kevin Matulef', u'email': u'matulef@gmail.com'}

Message: SERVER-3522 alternate (better) mem leak fix
Branch: master
https://github.com/mongodb/mongo/commit/5d8132786c6f6dd445c66779e94c4dfde3db6942

Comment by Kevin Matulef [ 02/Dec/11 ]

Contributing a different fix using shared_ptr rather than delete.

Comment by Kevin Matulef [ 01/Dec/11 ]

My first commit.

Comment by auto [ 01/Dec/11 ]

Author:

{u'login': u'matulef', u'name': u'Kevin Matulef', u'email': u'matulef@gmail.com'}

Message: SERVER-3522 fixed memory leak
Branch: master
https://github.com/mongodb/mongo/commit/385289545e6c6172bb1076fe6577a7920d823859

Comment by Kevin Matulef [ 01/Dec/11 ]

Now deletes the connection c in the two places noted in the bug description.

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