Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'length' of undefined #48

Closed
benjaminbellamy opened this issue Nov 16, 2012 · 7 comments
Closed

TypeError: Cannot read property 'length' of undefined #48

benjaminbellamy opened this issue Nov 16, 2012 · 7 comments

Comments

@benjaminbellamy
Copy link

I get a strange error after a few seconds.
Using Node v0.8.14, uptime v3 branch interval

Mongoose: pings.aggregate({ '$match': { timestamp: { '$lte': new Date("Fri, 16 Nov 2012 20:40:54 GMT"), '$gte': new Date("Thu, 15 Nov 2012 20:40:54 GMT") } } }) { '$project': { check: 1, responsive: { '$cond': [ { '$and': [ '$isResponsive' ] }, 1, '\u001b[33m0\u001b[39m' ] }, time: 1, tags: 1 } } { '$group': { _id: '$check', count: { '$sum': 1 }, responsiveness: { '$avg': '$responsive' }, responseTime: { '$avg': '$time' }, tags: { '$first': '$tags' }, start: { '$first': 1353012054480 }, end: { '$first': 1353098454480 } } }
Mongoose: pings.aggregate({ '$match': { timestamp: { '$lte': new Date("Fri, 16 Nov 2012 20:40:54 GMT"), '$gte': new Date("Thu, 15 Nov 2012 20:40:54 GMT") } } }) { '$project': { check: 1, responsive: { '$cond': [ { '$and': [ '$isResponsive' ] }, 1, '\u001b[33m0\u001b[39m' ] }, time: 1, tags: 1 } } { '$unwind': '$tags' } { '$group': { _id: '$tags', count: { '$sum': 1 }, responsiveness: { '$avg': '$responsive' }, responseTime: { '$avg': '$time' }, start: { '$first': 1353012054480 }, end: { '$first': 1353098454480 } } }
Mongoose: pings.aggregate({ '$match': { timestamp: { '$lte': new Date("Fri, 16 Nov 2012 20:59:59 GMT"), '$gte': new Date("Fri, 16 Nov 2012 20:00:00 GMT") } } }) { '$project': { check: 1, responsive: { '$cond': [ { '$and': [ '$isResponsive' ] }, 1, '\u001b[33m0\u001b[39m' ] }, time: 1, tags: 1 } } { '$group': { _id: '$check', count: { '$sum': 1 }, responsiveness: { '$avg': '$responsive' }, responseTime: { '$avg': '$time' }, tags: { '$first': '$tags' }, start: { '$first': 1353096000000 }, end: { '$first': 1353099599999 } } }
Mongoose: pings.aggregate({ '$match': { timestamp: { '$lte': new Date("Fri, 16 Nov 2012 20:59:59 GMT"), '$gte': new Date("Fri, 16 Nov 2012 20:00:00 GMT") } } }) { '$project': { check: 1, responsive: { '$cond': [ { '$and': [ '$isResponsive' ] }, 1, '\u001b[33m0\u001b[39m' ] }, time: 1, tags: 1 } } { '$unwind': '$tags' } { '$group': { _id: '$tags', count: { '$sum': 1 }, responsiveness: { '$avg': '$responsive' }, responseTime: { '$avg': '$time' }, start: { '$first': 1353096000000 }, end: { '$first': 1353099599999 } } }

/var/uptime/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:437
throw err;
^
TypeError: Cannot read property 'length' of undefined
at Object.async.forEach (/var/uptime/node_modules/async/lib/async.js:81:17)
at QosAggregator.updateHourlyCheckQos (/var/uptime/lib/qosAggregator.js:40:11)
at async.waterfall.wrapIterator (/var/uptime/node_modules/async/lib/async.js:428:21)
at Collection.aggregate (/var/uptime/node_modules/mongoose/node_modules/mongodb/lib/mongodb/collection.js:1568:7)
at Cursor.nextObject (/var/uptime/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:540:5)
at Cursor.nextObject.commandHandler (/var/uptime/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:522:14)
at g (events.js:192:14)
at EventEmitter.emit (events.js:126:20)
at Db._callHandler (/var/uptime/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1473:25)
at Server.connect.connectionPool.on.server._serverState (/var/uptime/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:430:30)

@fzaninotto
Copy link
Owner

Weird. I can't reproduce the bug. Did you use a legacy Mongo database from Uptime V2, or did you start with a fresh database? How many checks do you have?

@benjaminbellamy
Copy link
Author

I used a fresh db. (Actually I installed Mongo 5mn before Uptime v3 and never installed v2).
It crashed with only one check. Now I have 3 of them and it still crashes.

@fzaninotto
Copy link
Owner

I just pushed a bugfix (7ed11c4) that may be related to your problem. Could you retest?

@benjaminbellamy
Copy link
Author

Pulled, testing…

@fzaninotto
Copy link
Owner

What's your MongoDB version? minimum should be 2.1.

@benjaminbellamy
Copy link
Author

Bingo.

db.version()
1.8.2

@benjaminbellamy
Copy link
Author

Mongo 2.2.1 installed: problem solved. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants