-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.3.1
-
Component/s: None
-
Environment:OS: Ubuntu 20.04.6 LTS
node.js / npm versions: UNKNOWN
Additional info:
mongosh "mongodb://mongoadmin:passwordone@mongodb-emea,mongodb-us,mongodb-apac/?replicaSet=TestRS"
Current Mongosh Log ID: 66f57b18f5eeacaea4964032
Connecting to: mongodb://<credentials>@mongodb-emea,mongodb-us,mongodb-apac/?replicaSet=TestRS&appName=mongosh+2.3.1
Using MongoDB: 7.0.14
Using Mongosh: 2.3.1
OS: Ubuntu 20.04.6 LTS node.js / npm versions: UNKNOWN Additional info: mongosh " mongodb://mongoadmin: passwordone@mongodb-emea ,mongodb-us,mongodb-apac/?replicaSet=TestRS" Current Mongosh Log ID: 66f57b18f5eeacaea4964032 Connecting to: mongodb://<credentials>@mongodb-emea,mongodb-us,mongodb-apac/?replicaSet=TestRS&appName=mongosh+2.3.1 Using MongoDB: 7.0.14 Using Mongosh: 2.3.1
-
Developer Tools
Problem Statement/Rationale
What is going wrong? What action would you like the Engineering team to take?
MongoDB nodes A,B,C configured as 3-node replica set. Node A has higher priority.
mongosh connects to the RS, runs a script containing an infinite loop
User kills mongod process on Node A (kill -9 <pid>)
mongosh process exits
Expected: mongosh does not exit; driver retries the write
Please be sure to attach relevant logs with any sensitive data redacted.
How to retrieve logs for: Compass; Shell
{"t":
{"$date":"2024-09-26T15:55:42.028Z"},"s":"E","c":"MONGOSH","id":1000000006,"ctx":"startup","msg":"Error: read ECONNRESET","attr":{"stack":"Error: read ECONNRESET\n at TCP.onStreamRead (node:internal/stream_base_commons:218:20)","name":"Error","message":"read E
CONNRESET","code":"ECONNRESET","errno":-104,"syscall":"read"}}
Steps to Reproduce
How could an engineer replicate the issue you’re reporting?
- Create 3-node RS
- Create JS script to perform insertOne() in an infinite loop
- Create JS script to perform find(); cursor.next() in an infinite loop
- Run each script in a separate mongosh shell - use either mongosh "mongodb://mongoadmin:passwordone@mongodb-emea,mongodb-us,mongodb-apac/?replicaSet=TestRS" script.js OR load("script.js")
- Kill the primary server using kill -9 <pid>
- Observe the mongosh instances exit.
Expected Results
What do you expect to happen?
The mongosh instances should NOT exit
Actual Results
What do you observe is happening?
The mongosh instances exit with Error: read ECONNRESET
Additional Notes
Any additional information that may be useful to include.
We have an environment set up where you can test this - we discovered the problem while testing an Instructor-Led Training module on the new Instruqt lab environment. Please contact me via Slack to arrange access.
Scripts we use:
record = { name: "A. Customer", address : "1600 Hoover Avenue", type: "Loan Application",value: 50000} db.loans.drop()while(true) { var v = db.loans.insertOne(record,{writeConcern: { w: "majority" }}) print ("Recorded application " + v.insertedId)}
lastidseen=MinKey while(true) { var cursor = db.loans.find({_id:{$gt:lastidseen}}) while (cursor.hasNext()) { var v = cursor.next() var id = v._id print("Sending a mail to A.Customer about application " +id) lastidseen = id; } }