diff --git a/lib/core/sdam/topology.js b/lib/core/sdam/topology.js index 5aa5df773f..35f241144e 100644 --- a/lib/core/sdam/topology.js +++ b/lib/core/sdam/topology.js @@ -1039,8 +1039,12 @@ function serverConnectEventHandler(server, topology) { }; } -function serverErrorEventHandler(server /*, topology */) { +function serverErrorEventHandler(server, topology) { return function(err) { + if (topology.s.state === STATE_CLOSING || topology.s.state === STATE_CLOSED) { + return; + } + if (isSDAMUnrecoverableError(err, server)) { resetServerState(server, err, { clearPool: true }); return;