-
Type:
Bug
-
Resolution: Gone away
-
Priority:
Major - P3
-
None
-
Affects Version/s: 4.1.0
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
I have a mongodb server on AWS running on ubuntu 18.04
I have a local ubuntu machine. I can connect to the mongodb server using robot3T. But my nodejs script will fail. with the following error:
{ MongoServerSelectionError: getaddrinfo ENOTFOUND ip-172-31-24-60 ip-172-31-24-60:9788
at Timeout.waitQueueMember.timer.setTimeout [as _onTimeout] (/home/shiy/flair/datapipeline/node_modules/mongodb/lib/core/sdam/topology.js:438:30)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
name: 'MongoServerSelectionError',
reason:
TopologyDescription {
type: 'ReplicaSetNoPrimary',
setName: 'rs0',
maxSetVersion: 1,
maxElectionId: 7fffffff0000000000000015,
servers: Map { 'ip-172-31-24-60:9788' => [ServerDescription] },
stale: false,
compatible: true,
compatibilityError: null,
logicalSessionTimeoutMinutes: null,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
commonWireVersion: 8 } }
/home/shiy/flair/datapipeline/node_modules/mongodb/lib/utils.js:671
throw error;
^TypeError: Cannot read property 'close' of undefined
at /home/shiy/flair/datapipeline/db_injection/mark_removed.js:31:24
at /home/shiy/flair/datapipeline/node_modules/mongodb/lib/utils.js:668:9
at err (/home/shiy/flair/datapipeline/node_modules/mongodb/lib/mongo_client.js:225:23)
at connectCallback (/home/shiy/flair/datapipeline/node_modules/mongodb/lib/operations/connect.js:366:5)
at topology.connect.err (/home/shiy/flair/datapipeline/node_modules/mongodb/lib/operations/connect.js:599:14)
at connectHandler (/home/shiy/flair/datapipeline/node_modules/mongodb/lib/core/sdam/topology.js:285:11)
at Object.selectServer [as callback] (/home/shiy/flair/datapipeline/node_modules/mongodb/lib/core/sdam/topology.js:668:9)
at Timeout.waitQueueMember.timer.setTimeout [as _onTimeout] (/home/shiy/flair/datapipeline/node_modules/mongodb/lib/core/sdam/topology.js:443:25)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
The same issue appeared in this bug too, but this bug was claimed to be fixed.
https://jira.mongodb.org/browse/NODE-2249
But I'm still seeing it using recent stack.
My server version:
MongoDB shell version v4.2.11
git version: ea38428f0c6742c7c2c7f677e73d79e17a2aab96
OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1804
distarch: x86_64
target_arch: x86_64
My nodejs driver
"mongodb": "^3.6.3",
similar to that bug, setting
useUnifiedTopology to false will resolve the problem, but I will see the
DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.