[SERVER-6810] Memory leak in mongos when using auth Created: 21/Aug/12  Updated: 11/Jul/16  Resolved: 22/Aug/12

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.2.0-rc1
Fix Version/s: 2.2.1, 2.3.0

Type: Bug Priority: Critical - P2
Reporter: Ben Becker Assignee: Ben Becker
Resolution: Done Votes: 0
Labels: authentication, sharding
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux
2 Shards
3 Replica Sets per shard
Authentication enabled; one admin user, one (sharded) db user. Using simple keyfile.


Operating System: ALL
Participants:

 Description   

When spawning 15 mongo shells which run the following simple script, mongos leaks approximitely 2mb of memory per minute:

for (i=0;i<10000;i++) { 
    db.getSiblingDB("admin").auth('b', 'b');
}

The same holds true when authenticating against a sharded database:

for (i=0;i<10000;i++) { 
    db.getSiblingDB("shtest").auth('a', 'a'); 
}

Connection pool stats are consistently at 819 during these tests:

        "connections" : {
                "current" : 16,
                "available" : 803
        },

No increase in resident memory is observed when sending non-auth commands/queries, such as:

for (i=0;i<10000;i++) { 
    db.getSiblingDB("admin").stats();
}



 Comments   
Comment by Daniel Pasette (Inactive) [ 23/Aug/12 ]

the post-commit hook didn't pick up the commit for this for some reason:

Message: SERVER:6810: free nonce once released from tsp
Branch: master
https://github.com/mongodb/mongo/commit/b1b0a1a6f9943fe938b367a90e790b32eb32386c

Comment by Ben Becker [ 22/Aug/12 ]

This issue is unrelated to SERVER-6785. It may also be impacting mongod.

There is a thread-local reference to lastNonce which is allocated in CmdGetNonce::run(). The reference is released but not freed in CmdAuthenticate::run().

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