{"issue":{"pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"state":"closed","user":{"avatar_url":"https://secure.gravatar.com/avatar/fb85008ca0158f08f46982b44c5484ac?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"fb85008ca0158f08f46982b44c5484ac","url":"https://api.github.com/users/tcoffin","login":"tcoffin","id":487109},"milestone":null,"assignee":null,"updated_at":"2011-11-12T06:06:32Z","labels":[],"closed_at":"2011-11-12T06:06:32Z","comments":1,"url":"https://api.github.com/repos/christkv/node-mongodb-native/issues/400","body":"node: v0.4.12\r\nnode-mongodb-native: 0.9.7\r\n\r\nI ran across an issue where I'd get the following exception:\r\nbuffer.js:374\r\n  if (end > this.length) throw new Error('oob');\r\n                               ^\r\nError: oob\r\n    at Buffer.slice (buffer.js:374:32)\r\n    at Socket.<anonymous> (/home/tcoffin/node_modules/mongodb/lib/mongodb/connection/connection.js:252:41)\r\n    at Socket.emit (events.js:64:17)\r\n    at Socket._onReadable (net.js:672:14)\r\n    at IOWatcher.onReadable [as callback] (net.js:177:10)\r\n\r\nDigging in to it I found that there was some scenario arising where maxBsonSize (connection.js) was ending up being undefined. \r\n\r\nThe temporary workaround that I applied was to change ConnectionPool.prototype.setMaxBsonSize (connect_pool.js) to add a check for an undefined maxBsonSize being set; and apply DEFAULT_MAX_BSON_SIZE to it instead (not the cleanest solution since I've duplicated the constant in _pool.js)\r\n\r\n```javascript\r\nConnectionPool.prototype.setMaxBsonSize = function(maxBsonSize) {\r\n  var keys = Object.keys(this.openConnections);\r\n      \r\n  if ( typeof maxBsonSize == 'undefined' ){\r\n    maxBsonSize = DEFAULT_MAX_BSON_SIZE;\r\n  }     \r\n        \r\n  for(var i = 0; i < keys.length; i++) {\r\n    this.openConnections[keys[i]].maxBsonSize = maxBsonSize;\r\n  }   \r\n}\r\n```","html_url":"https://github.com/christkv/node-mongodb-native/issues/400","title":"connections.js - maxBsonSize undefined","number":400,"id":2215347,"created_at":"2011-11-12T01:38:54Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/a132807512f576d8b2394a7a8b0379a0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"a132807512f576d8b2394a7a8b0379a0","url":"https://api.github.com/users/christkv","login":"christkv","id":5569},"updated_at":"2011-11-12T06:06:32Z","url":"https://api.github.com/repos/christkv/node-mongodb-native/issues/comments/2716254","body":"merged in and released 0.9.7-0 for npm, out off curiosity what server version of mongo do you use ?","id":2716254,"created_at":"2011-11-12T06:06:32Z"}}