-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
no disconnection after a re-connection #6249
Comments
@tomgrossman you make incredibly detailed bug reports. Thank you. I started your code without modification (using @5.0.10), then stopped and started the server several times. I see the disconnect event each time I stop the server and the ready states line up with: connectionstate.js:
here is my output:
here is the contents of the file I ran above:
|
@lineus Mmm weird, it happens to me all the time. The only information I left out is that it's a |
I think the mongos piece is the difference between our results. I'll tinker with it over the weekend and see what if anything I can find. this issue against the native driver calls out event weirdness in mongos, and the last response was that they're going to refactor the connection code in a few months. |
Yep this only happens with mongos. Investigating now. |
I put in a PR mongodb/node-mongodb-native#1685 ☝️ that looks like it fixes this issue. Will hustle to get it out, thanks for your patience @tomgrossman |
@vkarpov15 thanks for updating! I had many re-connections problems to non-consistent |
Yes that's something we need to add. We normally don't do that because we rely on the mongodb driver to handle the differences between individual topologies, but I think its worth having a high-level check. |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
After the connection is
re-connected
and DB goes down again, there is no disconnection event and thereadyState
stays in1 - connected
If the current behavior is a bug, please provide the steps to reproduce.
readyState
is 1readyState
is 0readyState
is 1disconnected
event and thereadyState
is 1using the below script, the console output is:
you can see that the ping to the server turns to
false
but there is no disconnection.the script that is used:
What is the expected behavior?
When there is a connection loss, there should be a
disconnected
event and thereadyState
should update accordingly, like in the first disconnection.I've tested almost the same script with the latest native driver using the
isConnected
function instead of thereadyState
and it works fine there. whenever the ping is gone, theisConnected
function returnsfalse
.Please mention your node.js, mongoose and MongoDB version.
node.js - 8.10.0
mongoose - 5.0.10
MongoDB - 3.4.10
The text was updated successfully, but these errors were encountered: