New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
startSession() hangs #8239
Comments
I'm currently facing the exact same issue. Starting my app normally with 3 Replicas. Transactions works perfectly. I just shutdown on 1 Replica. Transactions doesn't work anymore, till I restart mongoose and starting the replica again. |
@lahiruchandima @endbay what version of Mongoose are you using? |
Newest but I found out, it was probably the MongoDB bug with https://jira.mongodb.org/browse/NODE-2231?jql=text%20~%20%22useUnifiedTopology%22 Since I've using old deprecated useUnifiedTopology, everything is working without issues anymore. |
In my case, I was creating session the wrong way like you did. mongoose.startSession() Rather you should create the session with the mongo connection you created. I have written a stackoverflow answer after I was able to solve my issue. Please refer if you are still stuck. |
I am using mongoose to connect to my Mongodb Atlas cluster through my nodejs server.
There is a certain operation which is done as a transaction. I call
mongoose.startSession()
to start the transaction. Very infrequently, thismongoose.startSession()
call hangs indefinitely.I noticed that there had been a primary node failover in the cluster at the time at which the issue occurred, so this could be caused due to not correctly identifying the failover. I do not have capability to manually do a failover, so I am unable to try to reproduce this by doing failovers.
Following is the code I use to start session.
In above code,
starting session
. gets logged, butsession started
doesn't get logged when issue occurs.I connect to the db like below:
Can this be an issue in Mongoose?
The text was updated successfully, but these errors were encountered: