christkv/node-mongodb-native — Issue #366: replication set failover error
Author: jeffallen6767
Created: 2011-10-08 00:28:49+00:00
State: open

Hi,
Thanks for the great module, it's worked great for us so far, but
here's a new problem we're having:

we've been using mongoose@2.2.3 which uses this driver

We've set-up:
a primary dedicated server with a fail-over/backup

we connect like so:
mongoDb = Mongoose.createSetConnection("mongodb://
:@:/,mongodb://:@:/");

works until we step-down the primary to test the fail-over then we
get:
============================================ checkMaster_::1
============================================ checkMaster_::3
============================================ checkMaster_::0::[ {
host: '',
port: '',
options: {},
internalMaster: true,
autoReconnect: [Getter],
connection: [Getter/Setter],
master: [Getter/Setter],
masterConnection: [Getter],
internalConnection:
{ host: '',
port: '',
autoReconnect: false,
drained: true,
messages: [],
sizeOfMessage: 0,
bytesRead: 0,
buffer: '',
stubBuffer: '',
_events: [Object],
connection: [Object],
receiveListener: [Function] } },
{ host: '',
port: '',
options: {},
internalMaster: false,
autoReconnect: [Getter],
connection: [Getter/Setter],
master: [Getter/Setter],
masterConnection: [Getter],
internalConnection:
{ host: '',
port: '',
autoReconnect: false,
drained: true,
messages: [],
sizeOfMessage: 0,
bytesRead: 0,
buffer: '',
stubBuffer: '',
_events: [Object],
connection: [Object],
receiveListener: [Function] } } ]
============================================ checkMaster_::1
============================================ checkMaster_::3
node.js:134
throw e; // process.nextTick error, or 'error' event on first
tick
^
Error: Socket is not writable
at Socket._writeOut (net.js:391:11)
at Socket.write (net.js:377:17)
at [object Object].sendwithoutReconnect
(/opt/unifi/node/tools/node_modules/mongoose/support/node-mongodb-
native/lib/mongodb/connection.js:158:27)
at /opt/unifi/node/tools/node_modules/mongoose/support/node-mongodb-
native/lib/mongodb/db.js:623:23
at Array.forEach (native)
at [object Object].checkMaster_
(/opt/unifi/node/tools/node_modules/mongoose/support/node-mongodb-
native/lib/mongodb/db.js:601:31)
at [object Object].executeCommand
(/opt/unifi/node/tools/node_modules/mongoose/support/node-mongodb-
native/lib/mongodb/db.js:546:12)
at [object Object].findOne
(/opt/unifi/node/tools/node_modules/mongoose/support/node-mongodb-
native/lib/mongodb/collection.js:445:11)
at Array.
(/opt/unifi/node/tools/node_modules/mongoose/lib/mongoose/drivers/node-
mongodb-native/collection.js:65:25)
at EventEmitter._tickCallback (node.js:126:26)

So we tried updating to the latest mongoose, version:

mongoose@2.3.0 ../node_modules/mongoose
├── hooks@0.1.9
├── colors@0.5.0
└── mongodb@0.9.6-20

ran the same test, and now we get:

node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot call method 'getRequestId' of null
at [object Object].executeCommand
(/opt/unifi/node/tools/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:764:48)
at Collection.update
(/opt/unifi/node/tools/node_modules/mongoose/node_modules/mongodb/lib/mongodb/collection.js:421:26)
at Collection.save
(/opt/unifi/node/tools/node_modules/mongoose/node_modules/mongodb/lib/mongodb/collection.js:343:10)
at Array.
(/opt/unifi/node/tools/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:66:25)
at EventEmitter._tickCallback (node.js:126:26)

Any help is appreciated.
Thanks,
Jeff