Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-212

socketTimeoutMS defaulting to 30000 on reconnect

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.4.8
    • Affects Version/s: 1.4
    • Component/s: None

      I've noticed this when working with connections to replica sets; it may also affect connections to standalone mongo instances. If the driver's connection to a replica set is broken (such as if a minority of nodes are up and the primary steps down) and auto_reconnect is true, when the connection is reestablished, the socketTimeoutMS options seems to default to 30 seconds. I noticed this by looking at the mongod.log and saw that every 30 seconds, the connection was being destroyed and recreated; this wasn't happening before the connection was first broken and reestablished.

      Normally this wouldn't concern me since the connection still worked after reconnecting, but I found that if my app tried to call the database during one of the periodic connection recreations, it would result in an error (since the connection was destroyed at the time).

      Setting replSet.socketOptions.socketTimeoutMS = 0 in the options when first calling MongoClient.connect() didn't seem to help.

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            leichter Evan Leichter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: