You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I opened this ticket for an issue I had been facing for a while now, but it had been closed without a fix. I attached a reproduce script to this ticket, where issue can be easily recreated.
In above code, whenever the primary instance of the mongodb replica set is stopped, mongoose.startSession() neither succeeds, nor fails. It just hangs.
I tested with both useUnifiedTopology enabled and disabled, and the issue exists in both cases.
I tested with a DB query operation instead of mongoose.startSession(), and when a primary failover occurs, the immediate next read operation fails (doesn't hang like startSession), and consequent read operations succeed, which is acceptable.
The text was updated successfully, but these errors were encountered:
The problem seems to lie in _wrapConnHelper() function in connection.js of mongoose. If the connection is not in STATES.connected state, function waits until open event to get fired, but it never gets fired on a re-connection. Instead, reconnect event gets fired on a re-connection.
I modified the function to handle reconnect event too, and it now works on a reconnection. Following is the function after the modification.
The fix is not ideal since it doesn't protect fn.apply() from getting called twice, once in open event and again in reconnect event. It would be great if someone who is familiar with the code can give a proper fix soon.
vkarpov15
added
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
and removed
needs repro script
Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue
labels
Nov 19, 2019
I opened this ticket for an issue I had been facing for a while now, but it had been closed without a fix. I attached a reproduce script to this ticket, where issue can be easily recreated.
Reproduce script:
https://drive.google.com/open?id=1rN0nBTOwkEnLzPMCpR3pyhLd19fQB64i
In above code, whenever the primary instance of the mongodb replica set is stopped,
mongoose.startSession()
neither succeeds, nor fails. It just hangs.I tested with both
useUnifiedTopology
enabled and disabled, and the issue exists in both cases.I tested with a DB query operation instead of
mongoose.startSession()
, and when a primary failover occurs, the immediate next read operation fails (doesn't hang like startSession), and consequent read operations succeed, which is acceptable.The text was updated successfully, but these errors were encountered: