mongodb/node-mongodb-native — pull request #605 by mattbornski (2012-05-14 23:43:52+00:00)
Title: "Error: no open connections" when secondary drops out of replicaset

I have constructed a few new test cases to reproduce a problem we observed recently when we removed a secondary MongoDB node from a replicaset:

```bash
nixon:node-mongodb-native matt$ make test_all
# make -C ./external-libs/bson all

== Run All tests ==
node dev/tools/test_all.js --boot

OK: 0 assertions (0ms)

shutdown_test.js
err: DEBUG: ** Starting a replica set with 5 nodes
err: DEBUG: stdout: forked process: 41509
all output going to: /Users/matt/node-mongodb-native/data/log-30000

DEBUG: stderr:
err: DEBUG: stdout: forked process: 41518
all output going to: /Users/matt/node-mongodb-native/data/log-30004

DEBUG: stderr:
err: DEBUG: stdout: forked process: 41520
all output going to: /Users/matt/node-mongodb-native/data/log-30002

DEBUG: stderr:
err: DEBUG: stdout: forked process: 41523
all output going to: /Users/matt/node-mongodb-native/data/log-30001

err: DEBUG: stderr:
err: DEBUG: stdout: forked process: 41524
all output going to: /Users/matt/node-mongodb-native/data/log-30003

DEBUG: stderr:
err: DEBUG: ** Ensuring members are up...
............all members up!

✔ shouldContinueToQueryWithPrimaryNodeSteppedDown
err: DEBUG: ** Killing node with pid 41520 at port 30002
err: DEBUG: stdout:
DEBUG: stderr:
✔ shouldContinueToQueryWithPrimaryNodeShutdown
err: DEBUG: stdout: forked process: 41533
all output going to: /Users/matt/node-mongodb-native/data/log-30002

DEBUG: stderr:
err: DEBUG: ** Killing node with pid 41509 at port 30000
err: DEBUG: stdout:
DEBUG: stderr:
============================= caught error
[Error: no open connections]
Error: no open connections
at /Users/matt/node-mongodb-native/lib/mongodb/db.js:1347:23
at Db._executeQueryCommand (/Users/matt/node-mongodb-native/lib/mongodb/db.js:1556:5)
at Cursor.nextObject (/Users/matt/node-mongodb-native/lib/mongodb/cursor.js:459:13)
at Array.0 (/Users/matt/node-mongodb-native/lib/mongodb/cursor.js:165:12)
at EventEmitter._tickCallback (node.js:192:40)
✖ shouldContinueToQueryWithSecondaryNodeShutdown

AssertionError: true == false
at Object.ok (/Users/matt/node-mongodb-native/node_modules/nodeunit/lib/types.js:83:39)
at /Users/matt/node-mongodb-native/test/replicaset/shutdown_test.js:225:20
at /Users/matt/node-mongodb-native/lib/mongodb/collection.js:881:28
at /Users/matt/node-mongodb-native/lib/mongodb/cursor.js:124:30
at /Users/matt/node-mongodb-native/lib/mongodb/cursor.js:166:32
at /Users/matt/node-mongodb-native/lib/mongodb/cursor.js:438:48
at /Users/matt/node-mongodb-native/lib/mongodb/db.js:1347:14
at Db._executeQueryCommand (/Users/matt/node-mongodb-native/lib/mongodb/db.js:1556:5)
at Cursor.nextObject (/Users/matt/node-mongodb-native/lib/mongodb/cursor.js:459:13)
at Array.0 (/Users/matt/node-mongodb-native/lib/mongodb/cursor.js:165:12)

err: DEBUG: stdout: all output going to: /Users/matt/node-mongodb-native/data/log-30000
forked process: 41537

DEBUG: stderr:
✔ noGlobalsLeaked

FAILURES: 1/22 assertions failed (130466ms)
```