Glimpse / Home

Project Glimpse: Node Edition - Spend less time debugging and more time developing.
http://node.getglimpse.com
Other
252 stars 9 forks source link

Mongoose / MongoDB error (related to replica set maybe)? #105

Open krstffr opened 7 years ago

krstffr commented 7 years ago

Just installed glimpse and tried running it in a very simple application, which basically does a .find on some Mongoose model, and it throws the error below.

Update when looking deeper into this: This only occurs when I connect to a replica set hosted on MongoDB Atlas though, not when running a single mogod on my own computer.

Versions Mongoose: 4.9.9 Express: 4.15.2 Node: 6.10.3

TypeError: Cannot read property 'availableConnections' of undefined
    at Function.MongoDBInspector.GetConnectionInfoFromCursor (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/inspectors/MongoDBInspector.js:537:40)
    at MongoDBInspector.readStartInspector (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/inspectors/MongoDBInspector.js:461:51)
    at Object.listeners._a.(anonymous function) [as listener] (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/inspectors/MongoDBInspector.js:144:23)
    at Tracing.publish (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/tracing/Tracing.js:31:26)
    at MongoDBProxy.cursorStartReadProxyCallbackOrPromise (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/tracing/module_instrumentors/MongoDBProxy.js:131:31)
    at Cursor.proxy [as toArray] (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/tracing/module_instrumentors/MongoDBProxy.js:63:40)
    at /APP_PATH/node_modules/mquery/lib/collection/node.js:29:12
    at handleCallback (/APP_PATH/node_modules/mongodb/lib/utils.js:120:56)
    at Collection.find (/APP_PATH/node_modules/mongodb/lib/collection.js:385:44)
    at NativeCollection.(anonymous function) [as find] (/APP_PATH/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:126:28)
    at NodeCollection.find (/APP_PATH/node_modules/mquery/lib/collection/node.js:26:19)
    at Query.find (/APP_PATH/node_modules/mquery/lib/mquery.js:1730:20)
    at Query._find (/APP_PATH/node_modules/mongoose/lib/query.js:1135:26)
    at /APP_PATH/node_modules/kareem/index.js:257:8
    at /APP_PATH/node_modules/kareem/index.js:23:7
    at wrappedCallback (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/async-track/async-track.js:293:33)
nikmd23 commented 7 years ago

We apologize for the bug you've found, and thank you for the error report!

We'll get this fixed and a patch release out as soon as possible.

To aide in our efforts to reproduce this, can you verify the version of the mongodb package installed by Mongoose for us?

On May 15, 2017, at 3:33 AM, Kristoffer Klintberg notifications@github.com wrote:

Just installed glimpse and tried running it in a very simple application, which basically does a .find on some Mongoose model, and it throws the error below.

Update when looking deeper into this: This only occurs when I connect to a replica set hosted on MongoDB Atlas though, not when running a single mogod on my own computer.

Versions Mongoose: 4.9.9 Express: 4.15.2 Node: 6.10.3

TypeError: Cannot read property 'availableConnections' of undefined at Function.MongoDBInspector.GetConnectionInfoFromCursor (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/inspectors/MongoDBInspector.js:537:40) at MongoDBInspector.readStartInspector (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/inspectors/MongoDBInspector.js:461:51) at Object.listeners._a.(anonymous function) [as listener] (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/inspectors/MongoDBInspector.js:144:23) at Tracing.publish (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/tracing/Tracing.js:31:26) at MongoDBProxy.cursorStartReadProxyCallbackOrPromise (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/tracing/module_instrumentors/MongoDBProxy.js:131:31) at Cursor.proxy [as toArray] (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/tracing/module_instrumentors/MongoDBProxy.js:63:40) at /APP_PATH/node_modules/mquery/lib/collection/node.js:29:12 at handleCallback (/APP_PATH/node_modules/mongodb/lib/utils.js:120:56) at Collection.find (/APP_PATH/node_modules/mongodb/lib/collection.js:385:44) at NativeCollection.(anonymous function) [as find] (/APP_PATH/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:126:28) at NodeCollection.find (/APP_PATH/node_modules/mquery/lib/collection/node.js:26:19) at Query.find (/APP_PATH/node_modules/mquery/lib/mquery.js:1730:20) at Query._find (/APP_PATH/node_modules/mongoose/lib/query.js:1135:26) at /APP_PATH/node_modules/kareem/index.js:257:8 at /APP_PATH/node_modules/kareem/index.js:23:7 at wrappedCallback (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/async-track/async-track.js:293:33) — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

krstffr commented 7 years ago

From my yarn.lock file:


mongodb-core@2.1.10:
  version "2.1.10"
  resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-2.1.10.tgz#eb290681d196d3346a492161aa2ea0905e63151b"
  dependencies:
    bson "~1.0.4"
    require_optional "~1.0.0"

mongodb@2.2.26:
  version "2.2.26"
  resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-2.2.26.tgz#1bd50c557c277c98e1a05da38c9839c4922b034a"
  dependencies:
    es6-promise "3.2.1"
    mongodb-core "2.1.10"
    readable-stream "2.2.7"

mongoose@^4.9.3:
  version "4.9.9"
  resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-4.9.9.tgz#8671fbe06c945f55fba7ad03797bc02f19516762"
  dependencies:
    async "2.1.4"
    bson "~1.0.4"
    hooks-fixed "2.0.0"
    kareem "1.4.1"
    mongodb "2.2.26"
    mpath "0.2.1"
    mpromise "0.5.5"
    mquery "2.3.0"
    ms "0.7.2"
    muri "1.2.1"
    regexp-clone "0.0.1"
    sliced "1.0.1"```
mike-kaufman commented 7 years ago

Thanks for reporting this @krstffr. Any chance you can get us a small project that reproduces the issue? I'll take a quick look at our logic. I thought our mongo DB instrumentation was turned off at the moment...

krstffr commented 7 years ago

Hi @mike-kaufman, the problem though is that it works when using my local DB, but not when I'm using the MongoDB Atlas one, so I might be able to set up this testv app for you if you yourselves are willing to set up an Atlas DB account etc since I unfortunately can't lend you mine?

mike-kaufman commented 7 years ago

Thanks @krstffr. I'll see if I can set up an atlas DB & repro this...

krstffr commented 7 years ago

Cool @mike-kaufman, thanks a lot!

azappa commented 7 years ago

Got the same error too with compose.io (db got replica) using https://github.com/Automattic/monk.