christkv/node-mongodb-native — Issue #370: upgrading to 0.9.6-21 from 0.9.6-17 causes findAndModify errors
Author: andrewjstone
Created: 2011-10-12 17:27:13+00:00
State: open

When issuing the following frindAndModify command I get a timeout error.

contest.findAndModify(
{_id: self._id, 'plays.uuid': _uuid},
[],
{$set : {'plays.$.active': true, 'plays.$.cursor': contest.play_cursor}},
{new: true, fields: {plays: 0, results: 0}, safe: {w:2, wtimeout:5000}},
function(err, contest) {
}
)

This seems to be occurring due to some connection/bson error. I see the following in the mongodb log right before the error.

Wed Oct 12 12:50:32 [conn98262] Assertion: 10334:Invalid BSONObj size: 0 (0x00000000) first element: 61f-d1b0db15e325: ?type=57
0x55f5aa 0x4ee52e 0x539ee8 0x75f075 0x75470b 0x759ec8 0x8a8fce 0x8bb630 0x7f4b9c075d8c 0x7f4b9b62004d
/usr/bin/mongod(_ZN5mongo11msgassertedEiPKc+0x12a) [0x55f5aa]
/usr/bin/mongod(_ZNK5mongo7BSONObj14_assertInvalidEv+0x46e) [0x4ee52e]
/usr/bin/mongod(_ZN5mongo9DbMessage9nextJsObjEv+0x148) [0x539ee8]
/usr/bin/mongod(_ZN5mongo12QueryMessageC1ERNS_9DbMessageE+0x175) [0x75f075]
/usr/bin/mongod() [0x75470b]
/usr/bin/mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_8SockAddrE+0x5b8) [0x759ec8]
/usr/bin/mongod(_ZN5mongo10connThreadEPNS_13MessagingPortE+0x21e) [0x8a8fce]
/usr/bin/mongod(thread_proxy+0x80) [0x8bb630]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x6d8c) [0x7f4b9c075d8c]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f4b9b62004d]
Wed Oct 12 12:50:32 [conn98262] AssertionException in connThread, closing client connection
Wed Oct 12 12:50:32 [conn98262] Invalid BSONObj size: 0 (0x00000000) first element: 61f-d1b0db15e325: ?type=57

The backtrace from the error (before the calls to our code) is the following:

.../node_modules/mongodb/lib/mongodb/collection.js:576:7
at Object._onTimeout (..../app/core/db.js:71:20)
at Timer.callback (timers.js:83:39)