-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Connection timeout in Mongoose, Mongo server sees a connection that stays for 6ms only #9094
Comments
What can be the cause of this issue? |
Hi, I'm having a similar error since updating to 5.9.16. Unhandled rejection MongooseServerSelectionError: connection timed out
at new MongooseServerSelectionError (D:\App\server\node_modules\mongoose\lib\error\serverSelection.js:24:11)
at NativeConnection.Connection.openUri (D:\App\server\node_modules\mongoose\lib\connection.js:823:32)
at Mongoose.createConnection (D:\App\server\node_modules\mongoose\lib\index.js:279:17)
at Object.openMongoConnection (D:\App\server\connections.js:65:23)
at Object.openBIG (D:\App\server\connections.js:88:21)
at Object.<anonymous> (D:\App\server\server.js:63:59)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Program Files\iisnode\interceptor.js:210:1)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 What is the workaround or fix? |
Without looking at how your docker container is set up, no way for me to know. This error bubbles up from Node sockets' 'timeout' event, so it may be that the MongoDB server isn't allowed to write to the socket? I'd try connecting to your docker container using the |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I receive connection timeout when connecting to my mongo container (freshly started, pinging and running) in my tests (using Gitlab-runner in docker).
Here is the complete stacktrace:
The connection config is as follow:
And in the mongo logs, I see those lines related to the connection/disconnection (which is definately not a timeout when looking at the timestamp):
What is the expected behavior?
A correct connection?
Before running my node code, there is a ping to the mongo container (which works fine with the right IP), the two containers are linked correctly and running correctly. I tested on two different runners (Ubuntu & OS X) and the issue is the same.
This problem is complicated to reproduce as it only happens in the gitlab runner and not always: 3/4 of the time.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Mongo 4.2, mongoose 5.9.17 and Node 12.
The text was updated successfully, but these errors were encountered: