PoolClearedOnNetworkError: ...mongodb.net:27017 interrupted due to server monitor timeout

Hi, I am just doing normal CRUD operation using mongoose in my nodejs application, and suddenly this error pop out.

                 connection.onError(new errors_1.PoolClearedOnNetworkError(this));
 PoolClearedOnNetworkError: Connection to ac-727rc86-shard-00-01.fgbtzus.mongodb.net:27017 interrupted due to server monitor timeout
     at ConnectionPool.interruptInUseConnections (/usr/src/app/node_modules/mongodb/lib/cmap/connection_pool.js:262:36)
     at /usr/src/app/node_modules/mongodb/lib/cmap/connection_pool.js:249:41
     at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
   address: 'ac-727rc86-shard-00-01.fgbtzus.mongodb.net:27017',
   [Symbol(errorLabels)]: Set(1) { 'RetryableWriteError' }

May I ask what may lead to this error, and how I can solve it or retry the connection using mongoose?


The error generally indicates intermittent network instability. The driver cancels the ongoing operations to a node when a network timeout occurs (i.e., the heartbeat takes longer than connectTimeoutMS), assuming that a timeout indicates server unreachability. To address this I’d recommend checking out this post and monitoring the network changes.

Also to read more about it please refer to Connection Monitoring - MongoDB Specification. In case of any further questions, feel free to reach out!

Best regards,

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.