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

publish-counts causes mongodb connection timeout with large datasets #86

Closed
tgoldenberg opened this issue May 10, 2016 · 3 comments
Closed
Labels

Comments

@tgoldenberg
Copy link

When I use this package locally with meteor run I have no errors and it works great. When I use meteor build and deploy the app in production, my connection to mongo crashes. Here are the logs. I hope there is an answer to this problem.

   at /home/will/portal/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongodb/cursor.js:835:31
    at [object Object].<anonymous> (/home/will/portal/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongodb/db.js:1905:9)
    at [object Object].g (events.js:180:16)
    at [object Object].emit (events.js:98:17)
    at [object Object].Base.__executeAllServerSpecificErrorCallbacks (/home/will/portal/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongodb/connection/base.js:373:29)
    at Server.<anonymous> (/home/will/portal/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongodb/connection/repl_set/ha.js:469:10)
    at Server.g (events.js:180:16)
    at Server.emit (events.js:98:17)
    at [object Object].<anonymous> (/home/will/portal/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:521:88)
Exception while polling query {"collectionName":"articles","selector":{},"options":{"transform":null,"fields":{"_id":true}}}: MongoError: connection to [finance-production-mongodb-0.aqcqtyqs0tre1dl3mqmpmo4ogd.cx.internal.cloudapp.net:27000] timed out
    at Object.Future.wait (/home/will/portal/programs/server/node_modules/fibers/future.js:420:15)
    at SynchronousCursor._nextObject (packages/mongo/mongo_driver.js:986:47)
    at SynchronousCursor.forEach (packages/mongo/mongo_driver.js:1020:22)
    at SynchronousCursor.getRawObjects (packages/mongo/mongo_driver.js:1069:12)
    at PollingObserveDriver._pollMongo (packages/mongo/polling_observe_driver.js:152:48)
    at Object.task (packages/mongo/polling_observe_driver.js:90:12)
    at [object Object]._.extend._run (packages/meteor.js:800:18)
    at packages/meteor.js:778:14
    - - - - -
    at Object.toError (/home/will/portal/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongodb/utils.js:114:11)
    at /home/will/portal/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongodb/cursor.js:835:31
    at [object Object].<anonymous> (/home/will/portal/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongodb/db.js:1905:9)
    at [object Object].g (events.js:180:16)
    at [object Object].emit (events.js:98:17)
@boxofrox
Copy link
Contributor

Exception while polling query {"collectionName":"articles","selector":{},"options":{"transform":null,"fields":{"_id":true}}}:
  MongoError: connection to [finance-production-mongodb-0.aqcqtyqs0tre1dl3mqmpmo4ogd.cx.internal.cloudapp.net:27000] timed out

Indicates that your app lost its connection to the mongodb service. At first glance, this doesn't appear to be an issue specifically with publish-counts. You may have better luck on the meteor forums.

If you're adamant that publish-counts is causing the problem, then my recommendation is to set up a test with publish-counts removed and verify that the db connection doesn't time-out. If it doesn't time-out, try creating your own observer with Mongo.Cursor.observe [1] and verify the db connection doesn't time-out with that. If it does, then either Meteor or your MongoDB server is where the issue lies.

If the time-out doesn't occur, then I'm at a loss as to why publish-counts would instigate a time-out. At this point, I'd need a demo app that reproduces the problem as I have no experience deploying meteor apps.

@tgoldenberg
Copy link
Author

@boxofrox pretty sure this is because the size of the collection was way to big, according to the spec for this package. On dev, we had maybe 1000 docs, but on staging, it would be in the 10s of 1000s. 90% sure that is what caused the remote DB connection to crash. As soon as I removed the package, everything worked fine. Just something to know for people who try to use it for way too large sets ;)

@boxofrox boxofrox changed the title issue in deployment publish-counts causes mongodb connection timeout with large datasets May 13, 2016
@boxofrox
Copy link
Contributor

boxofrox commented May 13, 2016

Thanks for the clarification, @tgoldenberg. This makes sense and is mentioned indirectly in the Notes section of the README [1]. Tmeasday clarified in #76 that this package is for counting small datasets only [2].

If you need to count large datasets, there's a link in the Notes section to arunoda's timer-based counting method.

I'll update the notes section so it's more obvious.

Cheers

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

No branches or pull requests

2 participants