marcello3d / node-mongolian

[project inactive] Mongolian DeadBeef is an awesome Mongo DB driver for node.js
https://groups.google.com/group/node-mongolian
zlib License
349 stars 50 forks source link

Error after updating to 0.1.9 #22

Closed Charuru closed 13 years ago

Charuru commented 13 years ago

The error:

TypeError: Cannot set property 'maxListeners' of undefined
    at EventEmitter.setMaxListeners (events.js:12:29)
    at new <anonymous> (/Users/user/app/node_modules/mongolian/lib/server.js:81:22)
Charuru commented 13 years ago

Works after commenting out that line about replica sets.

marcello3d commented 13 years ago

That doesn't even make sense, what version of node do you have?

Charuru commented 13 years ago

I have 0.4.1

marcello3d commented 13 years ago

Aha, looks like a bug in node.js that has been fixed in v0.4.3. [v0.4.2]node/lib/events.js: https://github.com/joyent/node/blob/v0.4.2/lib/events.js

EventEmitter.prototype.setMaxListeners = function(n) {
  this._events.maxListeners = n;
};

[v0.4.3]node/lib/events.js: https://github.com/joyent/node/blob/v0.4.3/lib/events.js

EventEmitter.prototype.setMaxListeners = function(n) {
  if (!this._events) this._events = {};
  this._events.maxListeners = n;
};

For kicks, can you try moving the setMaxListeners command immediately below the this._replicaSet.on('lost',... block below it? That will probably fix it for pre v0.4.3 and I can check in that change.

Charuru commented 13 years ago

Yeah I should probably update.

And your suggestion works. Thanks again.