Skip to content

Commit

Permalink
fix(replset): destroy primary before removing from replsetstate
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Oct 15, 2019
1 parent 41d3060 commit 45ac09a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/core/topologies/replset.js
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,7 @@ function executeWriteOperation(args, options, callback) {

// Per SDAM, remove primary from replicaset
if (self.s.replicaSetState.primary) {
self.s.replicaSetState.primary.destroy();
self.s.replicaSetState.remove(self.s.replicaSetState.primary, { force: true });
}

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

// Per SDAM, remove primary from replicaset
if (this.s.replicaSetState.primary) {
this.s.replicaSetState.primary.destroy();
this.s.replicaSetState.remove(this.s.replicaSetState.primary, { force: true });
}

Expand Down
6 changes: 6 additions & 0 deletions test/runner/plugins/client_leak_checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ afterEach(() => {
});

after(() => wtfnode.dump());

require('leaked-handles').set({
fullStack: true, // use full stack traces
timeout: 30000, // run every 30 seconds instead of 5.
debugSockets: true // pretty print tcp thrown exceptions.
});

0 comments on commit 45ac09a

Please sign in to comment.