Skip to content

server crash with the problem of no primary server available #1057

Closed

Description

@mahabubakram

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

Environment Setup

1- heroku as parse server
2. mongolab as database

Steps to reproduce

automatically it gives the error and server get stopped. We had not this problem before 2.1.5 version

Logs/Trace

2016-03-16T12:59:01.702788+00:00 heroku[router]: at=info method=POST path="/parse/classes/PublicCombinations" host=combyne-parse-server-staging.herokuapp.com request_id=df76331e-c0bc-44d7-a85c-27b82fa3fa06 fwd="54.216.75.217" dyno=web.1 connect=0ms service=288ms status=500 bytes=551
2016-03-16T12:59:01.694481+00:00 app[web.1]: Uncaught internal server error. { [MongoError: no primary server available] name: 'MongoError', message: 'no primary server available' } MongoError: no primary server available
2016-03-16T12:59:01.694522+00:00 app[web.1]:     at pickServer (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js:953:13)
2016-03-16T12:59:01.694523+00:00 app[web.1]:     at ReplSet.getServer (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js:345:10)
2016-03-16T12:59:01.694525+00:00 app[web.1]:     at Cursor.next [as _next] (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js:655:3)
2016-03-16T12:59:01.694524+00:00 app[web.1]:     at nextFunction (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js:513:35)
2016-03-16T12:59:01.694526+00:00 app[web.1]:     at fetchDocs (/app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:843:10)
2016-03-16T12:59:01.694528+00:00 app[web.1]:     at /app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:827:5
2016-03-16T12:59:01.694529+00:00 app[web.1]:     at new Promise (/app/node_modules/parse-server/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:193:7)
2016-03-16T12:59:01.694531+00:00 app[web.1]:     at MongoCollection._rawFind (/app/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoCollection.js:69:90)
2016-03-16T12:59:01.694530+00:00 app[web.1]:     at Cursor.toArray (/app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:826:10)
2016-03-16T12:59:01.742048+00:00 app[web.1]:     at pickServer (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js:953:13)
2016-03-16T12:59:01.742049+00:00 app[web.1]:     at ReplSet.getServer (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js:345:10)
2016-03-16T12:59:01.694527+00:00 app[web.1]:     at toArray (/app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:870:3)
2016-03-16T12:59:01.742023+00:00 app[web.1]: Uncaught internal server error. { [MongoError: no primary server available] name: 'MongoError', message: 'no primary server available' } MongoError: no primary server available
2016-03-16T12:59:01.742050+00:00 app[web.1]:     at nextFunction (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js:513:35)
2016-03-16T12:59:01.742051+00:00 app[web.1]:     at fetchDocs (/app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:843:10)
2016-03-16T12:59:01.742050+00:00 app[web.1]:     at Cursor.next [as _next] (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js:655:3)
2016-03-16T12:59:01.742053+00:00 app[web.1]:     at /app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:827:5
2016-03-16T12:59:01.742056+00:00 app[web.1]:     at MongoCollection._rawFind (/app/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoCollection.js:69:90)
2016-03-16T12:59:01.742052+00:00 app[web.1]:     at toArray (/app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:870:3)
2016-03-16T12:59:01.742054+00:00 app[web.1]:     at new Promise (/app/node_modules/parse-server/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:193:7)
2016-03-16T12:59:01.742055+00:00 app[web.1]:     at Cursor.toArray (/app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:826:10)
2016-03-16T12:59:03.504828+00:00 heroku[router]: at=info method=POST path="/parse/classes/PublicCombinations" host=combyne-parse-server-staging.herokuapp.com request_id=d083b4f4-689f-42a3-8230-3eefaf9bf618 fwd="54.216.75.217" dyno=web.1 connect=1ms service=1603ms status=500 bytes=551
2016-03-16T12:59:03.500781+00:00 app[web.1]: Uncaught internal server error. { [MongoError: no primary server available] name: 'MongoError', message: 'no primary server available' } MongoError: no primary server available
2016-03-16T12:59:03.500821+00:00 app[web.1]:     at pickServer (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js:953:13)
2016-03-16T12:59:03.500822+00:00 app[web.1]:     at ReplSet.getServer (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js:345:10)
2016-03-16T12:59:03.500823+00:00 app[web.1]:     at nextFunction (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js:513:35)
2016-03-16T12:59:03.500824+00:00 app[web.1]:     at Cursor.next [as _next] (/app/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js:655:3)
2016-03-16T12:59:03.500825+00:00 app[web.1]:     at fetchDocs (/app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:843:10)
2016-03-16T12:59:03.500825+00:00 app[web.1]:     at toArray (/app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:870:3)
2016-03-16T12:59:03.500826+00:00 app[web.1]:     at /app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:827:5
2016-03-16T12:59:03.500827+00:00 app[web.1]:     at new Promise (/app/node_modules/parse-server/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:193:7)
2016-03-16T12:59:03.500829+00:00 app[web.1]:     at MongoCollection._rawFind (/app/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoCollection.js:69:90)
2016-03-16T12:59:03.500828+00:00 app[web.1]:     at Cursor.toArray (/app/node_modules/parse-server/node_modules/mongodb/lib/cursor.js:826:10)
2016-03-16T12:59:05.463629+00:00 heroku[router]: at=info method=POST path="/parse/classes/PublicCombinations" host=combyne-parse-server-staging.herokuapp.com request_id=016b169b-3e90-4217-a85f-eedc93179394 fwd="54.216.75.217" dyno=web.1 connect=1ms service=1488ms status=200 bytes=497900

when we check the server log. This error log shows and server get crashed/stopped. Then we need to restart the server. But this problem did not occur before. Right now we have the same setup like old. We just upgraded the parse server version to latest and suddenly this problem occurs.

How to solve this issue.

Activity

  1. gfosco commented on Mar 16, 2016

    @gfosco
    Contributor

    What does your mongo connection string look like?

  2. tobernguyen commented on Mar 19, 2016

    @tobernguyen
    Contributor

    I also experiencing this today, I use mLab with one replica set. My connection bumps up to over 4000 connection in 10 minutes, I have to restart the server to make the number of connections back to around 100.

    This issue may relate to this: Automattic/mongoose#3634

  3. tobernguyen commented on Mar 20, 2016

    @tobernguyen
    Contributor

    My mongo connection string look like this:
    mongodb://USER_NAME:PASSWORD@CLUSTER_1_ADDRESS:CLUSTER_1_PORT,CLUSTER_2_ADDRESS:CLUSTER_2_PORT/COLLECTION_NAME?replicaSet=xxxxxx

    After researching for awhile, I tried to change the connection to only primary cluster like this:
    mongodb://USER_NAME:PASSWORD@CLUSTER_1_ADDRESS:CLUSTER_1_PORT/COLLECTION_NAME

    So far so good, the number of connection is now stable at around 80 for more than 6 hours.
    @mahabubakram you can give a try and let us know does it work.

  4. drew-gross commented on Apr 14, 2016

    @drew-gross
    Contributor

    No response in many days, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:questionSupport or code-level question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions