-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: 4.9.1
-
Component/s: None
Setup
- OS: Ubuntu 20.04.4 LTS
- mongod --version
db version v6.0.1
Build Info: {
"version": "6.0.1",
"gitVersion": "32f0f9c88dc44a2c8073a5bd47cf779d4bfdee6b",
"openSSLVersion": "OpenSSL 1.1.1f 31 Mar 2020",
"modules": [],
"allocator": "tcmalloc",
"environment":{}{
}}{{"distmod": "ubuntu2004",
"distarch": "x86_64",
"target_arch": "x86_64"
{{ }}}
}}{
- mongodb/node-mongodb-native: 4.9.1
- NodeJS: 14.19.0
Setup replica set
- Run two mongod instances:
mongod --config /tmp/mongo/mongo1.conf
mongod --config /tmp/mongo/mongo2.conf - mongosh --port 27020
- configure replica set
members: [
{ _id: 0,
name: '127.0.0.1:27020',
health: 1,
state: 1,
stateStr: 'PRIMARY',
self: true,
...
}{},
{ _id: 1,
name: '127.0.0.1:27021',
health: 1,
{{ state: 2, }}
stateStr: 'SECONDARY',
...
{{ }}}
],
Reproduce steps
- Now mongo1 is PRIMARY, mongo2 is SECONDARY
- Run test script
$ node rs_async.js - All find() requests succeed
iterations: 1311, read documents: 1311
iterations: 2678, read documents: 2678 - run stepDown() on primary
$ mongosh --port 27020
test/rs_test:PRIMARY> rs.stepDown(60)
test/rs_test:SECONDARY> - Now mongo1 is SECONDARY, mongo2 is PRIMARY. All find() requests still succeed
- after 60 seconds mongod1 becomes PRIMARY again
- find() requests stucks
iterations: 50262, read documents: 50262
iterations: 50262, read documents: 50262 - each 30 seconds find() stopped by mongodb driver, next find() call stucks too
The replica set status is OK.
If stop the test script and run it again ('node rs_async.js'), all work.
Attachements
- configuration files for mongo1 and mongo2
- rs_async.js
- test output
- is caused by
-
NODE-3810 AWS Lambda: MongoDB heartbeat failure.
- Closed
- is related to
-
NODE-4820 Refactor connection class to enforce the "single track" spec rule
- Backlog
- related to
-
DRIVERS-2246 Heartbeat build up with streaming protocol when driver process is stopped (FAAS)
- Closed
-
NODE-4643 Fails in some cases to reconnect to replica set in failover mode with readpreference "primary"
- Closed