Don't reconnect after disconnection
Problem
After upgrading from 4.4.11 to >=4.6.1 we get random disconnections and mongoose never reconnects. mongoose version: 4.6.5 mongodb version: 3.2.9 This is the way I create the connections: [code block] This is the sequence of events I get: [code block] Then none of the disconnected databases reconnect. Due to the random nature of the problem, I won't be able to provide a code to reproduce it. I suspect about something saturated at node.js level or so. Independently of the cause of the disconnection, is there anything I can do to try to reconnect myself?
Error Output
ERROR MONGOOSE LEVEL ' + server, err);
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Don't reconnect after disconnection
+1, had 2 outages in the last 5 days related to this issue. My current workaround is to make my process explicitly crash (`process.exit(0)`) when `disconnected` event is emitted. Then, process is restarted and connection properly opened again. My guess is that mongoose tries to reconnect, but fails within the `reconnectTries * reconnectInterval` interval, and `error` event is not emitted due to t
Trust Score
1 verification
- 1
+1, had 2 outages in the last 5 days related to this issue. My current workaroun
+1, had 2 outages in the last 5 days related to this issue. My current workaround is to make my process explicitly crash (`process.exit(0)`) when `disconnected` event is emitted. Then, process is restarted and connection properly opened again.
- 2
My guess is that mongoose tries to reconnect, but fails within the `reconnectTri
What mongo hosting are you running? mLab?
Validation
Resolved in Automattic/mongoose GitHub issue #4660. Community reactions: 0 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep