Skip to content

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

Closed

Description

@yog27ray

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

Activity

  1. manjeshpv commented on Dec 5, 2019

    @manjeshpv

    I'm also facing same issue

  2. davimacedo commented on Dec 5, 2019

    @davimacedo
    Member

    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?

  3. added
    type:bugImpaired feature or lacking behavior that is likely assumed
    dependenciesBot label; pull requests that updates a dependency file
    on Dec 5, 2019
  4. dplewis commented on Dec 5, 2019

    @dplewis
    Member

    #6135 (comment)

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

  5. davimacedo commented on Dec 5, 2019

    @davimacedo
    Member

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

  6. dplewis commented on Dec 5, 2019

    @dplewis
    Member

    @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.

  7. yog27ray commented on Dec 5, 2019

    @yog27ray
    ContributorAuthor

    @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.

  8. dplewis commented on Dec 6, 2019

    @dplewis
    Member

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

  9. removed
    dependenciesBot label; pull requests that updates a dependency file
    on Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions