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

API does not recover from a temporary database connection interruption #327

fra967 opened this Issue Sep 18, 2017 · 2 comments


3 participants
Copy link

fra967 commented Sep 18, 2017

If the database (MongoDB) goes temporarily down API does not resume the connection but requires to be restarted

Steps to reproduce the problem

  • start API
  • send a request - works as expected
  • stop database
  • send a request - 500 error is returned after 30 seconds
MongoError: failed to reconnect after 30 attempts with interval 1000 ms
        at Connection.<anonymous> (/var/www/bauer-radio-api/api/node_modules/mongodb-core/lib/connection/pool.js:318:15)
  • restart database
  • send a request - 500 error is returned
MongoError: Topology was destroyed
        at nextFunction (/var/www/bauer-radio-api/api/node_modules/mongodb-core/lib/cursor.js:540:25)
  • API can resume only if manually restarted

Expected behaviour

API to resume functionality when the database connection is back.
It would also be useful to have control on the database connection attempts (30 every 1000 ms may be questionable in HA environments)

Actual behaviour

API returns 500

Package details

API 2.2.4
Node 6.11.2


This comment has been minimized.

Copy link

jimlambie commented Sep 18, 2017

This might be a useful solution to investigate


This comment has been minimized.

Copy link
Member Author

fra967 commented Sep 28, 2017

This is also applicable to Web when it uses MongoDB for sessions data

@jimlambie jimlambie added this to In Progress in API Version 3.0 Oct 10, 2017

@jimlambie jimlambie removed this from Backlog in API Roadmap Oct 10, 2017

@eduardoboucas eduardoboucas referenced this issue Oct 26, 2017


DB connection recovery (and more!) #344

4 of 4 tasks complete

@eduardoboucas eduardoboucas moved this from In Progress to Ready for Release in API Version 3.0 Oct 30, 2017

@jimlambie jimlambie closed this Dec 7, 2017

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