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

egg-mongoose: no timeout or retry if mongoose failed to connect on start #2403

Closed
legendecas opened this issue Apr 15, 2018 · 4 comments
Closed

Comments

@legendecas
Copy link

legendecas commented Apr 15, 2018

  • Node Version: 9.11.1
  • Egg Version: 2.6.1
  • Plugin Name: egg-mongoose
  • Plugin Version: 2.2.0
  • Platform: macOS
  • Mini Showcase Repository:

while using default config like

module.exports = {
 mongoose: {
    clients: {
      db: {
        url: 'mongodb://localhost:27017/notebook',
        options: {}
      }
    }
  }
}

and run egg-scripts start without a valid mongodb running on locallost, egg would not run web workers since egg-mongoose did not connect to mongodb instance yet. And there is no timeout for egg-mongoose's start connect, egg-scripts will not exit with non-zero code yet web workers did not run, and egg stuck.

Now if we start the mongodb instance, egg will not recover to start web workers.

Referring to issue No retries are made after "failed to connect on first connect", errors on first connection shall be re-thrown so that egg will exit with the error in time.

@legendecas legendecas changed the title egg-mongoose: egg workers did not start if mongoose failed to connect on start egg-mongoose: no timeout or retry if mongoose failed to connect on start Apr 15, 2018
@kkys4bfgp75be9p
Copy link

kkys4bfgp75be9p commented Apr 16, 2018

mongodb://127.0.0.1:27017/databaseName
得指定port

@legendecas
Copy link
Author

@zhangming0305 it can be assured it's not an issue related to the mongodb url

@kkys4bfgp75be9p
Copy link

kkys4bfgp75be9p commented Apr 18, 2018

@legendecas i suggest you to create minimal runnable github project that we can reproduce the same error.

legendecas added a commit to legendecas/egg-mongoose-reproduce that referenced this issue Apr 19, 2018
@legendecas
Copy link
Author

@zhangming0305 Hi, check out this repo https://github.com/legendecas/egg-mongoose-reproduce

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

3 participants