Skip to content

Commit 45ac09a

Browse files
committed
fix(replset): destroy primary before removing from replsetstate
1 parent 41d3060 commit 45ac09a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/core/topologies/replset.js

+2
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,7 @@ function executeWriteOperation(args, options, callback) {
12071207

12081208
// Per SDAM, remove primary from replicaset
12091209
if (self.s.replicaSetState.primary) {
1210+
self.s.replicaSetState.primary.destroy();
12101211
self.s.replicaSetState.remove(self.s.replicaSetState.primary, { force: true });
12111212
}
12121213

@@ -1368,6 +1369,7 @@ ReplSet.prototype.command = function(ns, cmd, options, callback) {
13681369

13691370
// Per SDAM, remove primary from replicaset
13701371
if (this.s.replicaSetState.primary) {
1372+
this.s.replicaSetState.primary.destroy();
13711373
this.s.replicaSetState.remove(this.s.replicaSetState.primary, { force: true });
13721374
}
13731375

test/runner/plugins/client_leak_checker.js

+6
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ afterEach(() => {
2626
});
2727

2828
after(() => wtfnode.dump());
29+
30+
require('leaked-handles').set({
31+
fullStack: true, // use full stack traces
32+
timeout: 30000, // run every 30 seconds instead of 5.
33+
debugSockets: true // pretty print tcp thrown exceptions.
34+
});

0 commit comments

Comments
 (0)