Skip to content

mongodb: 3.3.2 driver unable to connect with replica set when one node is down. #6261

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

Closed
yog27ray opened this issue Dec 5, 2019 · 7 comments · Fixed by #6263
Closed

mongodb: 3.3.2 driver unable to connect with replica set when one node is down. #6261

yog27ray opened this issue Dec 5, 2019 · 7 comments · Fixed by #6263
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@yog27ray
Copy link
Contributor

yog27ray commented Dec 5, 2019

MongoDB driver 3.3.2 is unable to connect to mongodb replicaSet if one of member machine is down.

Note: Same issue is described in https://jira.mongodb.org/browse/NODE-2231

Steps to reproduce

  1. Create mongodb replicaSet with 3 member.
  2. connect parse-server with mongodb providing all 3 member host name in uri.
  3. stop PRIMARY mongodb server
  4. MongoDB is able to select new PRIMARY from the available 2 member but parser-server is unable to connect to new PRIMARY mongodb node.

Note: Even we restart parse-server when one of the 3 member replicaSet mongodb is down and in mongo connection URI we have provided hostname for all the 3 member. It is not able to connect mongodb.

Expected Results

When one mongoDB replicaSet member goes down. It should automatically connect to new primary mongodb server.

Actual Outcome

Error: connect ECONNREFUSED x.x.x.x:port
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14) {
name: 'MongoNetworkError',
errorLabels: [ 'TransientTransactionError' ],
[Symbol(mongoErrorContextSymbol)]: {}
}

Environment Setup

  • Server

    • parse-server : 3.9.0
    • Operating System: Ubuntu 18.04
    • Hardware: R4.2x.large
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): AWS
  • Database

    • MongoDB version: 4.2 (also tested on 4.0.9)
    • Storage engine: WireTigger
    • Hardware: R4.2x.large
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): AWS
@manjeshpv
Copy link

I'm also facing same issue

@davimacedo
Copy link
Member

davimacedo commented Dec 5, 2019

As per the link you sent, it looks that updating the MongoDB package to the latest version should fix the problem. @dplewis why did you close #6242? Didn't it pass the tests?

@davimacedo davimacedo added type:bug Impaired feature or lacking behavior that is likely assumed dependencies Bot label; pull requests that updates a dependency file labels Dec 5, 2019
@dplewis
Copy link
Member

dplewis commented Dec 5, 2019

#6135 (comment)

The test have been failing, it should be an easy fix. I can look into it again shortly

@davimacedo
Copy link
Member

Sorry. I missed that one. Let me know if you need any help.

@dplewis
Copy link
Member

dplewis commented Dec 5, 2019

@yog27ray Can you try to see if the latest mongo driver update fixed your issue?

I should have a replica set somewhere to test with.

@davimacedo I’ll need help since I’ve been closing them. I haven’t had luck so far. At least we know where the issue is coming from.

@yog27ray
Copy link
Contributor Author

yog27ray commented Dec 5, 2019

@dplewis latest mongo driver has fixed my issue.

Below are the steps I used to confirm that latest mongo driver is fixing the issue.

  1. deleted mongodb driver 3.3.2 folder located at "node_modules/parse-server/node_modules/mongodb"
  2. copied mongodb driver 3.3.5 folder at "node_modules/parse-server/node_modules/mongodb"
  3. restarted parse-server

now even if I stop any replica member, parse-server is able to switch connection to other replica member and even i restart parse-server while keeping one member down it is able to communicate with other replica member.

We already configured replica set to verify the same if you want we can share the same with you.

@dplewis
Copy link
Member

dplewis commented Dec 6, 2019

I opened a PR #6263 for this. All the tests passes locally. Hopefully someone can fix the travis issues. Its up for grabs.

@mtrezza mtrezza removed the dependencies Bot label; pull requests that updates a dependency file label Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants