diff --git a/lib/core/topologies/replset.js b/lib/core/topologies/replset.js index 2e436abf27..a5c58bffd4 100644 --- a/lib/core/topologies/replset.js +++ b/lib/core/topologies/replset.js @@ -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 }); } @@ -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 }); } diff --git a/test/runner/plugins/client_leak_checker.js b/test/runner/plugins/client_leak_checker.js index f30f1d0d5a..1ab2857ae6 100644 --- a/test/runner/plugins/client_leak_checker.js +++ b/test/runner/plugins/client_leak_checker.js @@ -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. +});