Skip to content

Timestamp Auto closed the TCP cause MongoNetworkError #49

Description

@kayac-chang

I Worked with

  • "mongoose": 5.6.9
  • "mongoose-timestamp": 0.6.0

Do you want to request a feature or report a bug?
I want to report a bug.

What is the current behavior?
When I working with a long process task like transfer data from MySQL to Mongo Atlas.
I try so many time but finally I got this:

(node:74121) UnhandledPromiseRejectionWarning: MongoNetworkError: connection 2 to cluster0-shard-00-01-ug0nb.gcp.mongodb.net:27017 closed
    at TLSSocket.<anonymous> (/Users/kayac/Projects/Work/Backend_Server/node_modules/mongodb-core/lib/connection/connection.js:352:9)
    at Object.onceWrapper (events.js:288:20)
    at TLSSocket.emit (events.js:200:13)
    at net.js:586:12
    at TCP.done (_tls_wrap.js:479:7)

And My config like this:

    const db = await mongoose.connect(path, {
        useNewUrlParser: true,
        socketTimeoutMS: 600 * 1000,
        connectTimeoutMS: 600 * 1000,
        autoReconnect: true,
        keepAlive: true,
        reconnectTries: 30,
        poolSize: 20,
    });

socketTimeoutMSand connectTimeoutMS both doesn't help.

But I remove the

const timestamps = require('mongoose-timestamp');
Schema.plugin(timestamps);

And My task success.

Did mongoose timestamp auto close the TCP connection when process too long?

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions