mongoose: Problem with connection to db , queries hang. Reverting to mongoose 4.6.6 solves it

Mongoose 4.7.7

Do you want to request a feature or report a bug? I want to report a bug

What is the current behavior? All request towards the db just hang and do not return anything

If the current behavior is a bug, please provide the steps to reproduce.

const ODconnection = mongoose.createConnection(config.mongo.uri, config.mongo.options);
ODconnection.on('error', err => {
  logger.error(err);
});
module.exports.ODconnection = ODconnection;


var connection = require('../../config/connections').ODconnection;
var ProgramSchema = new mongoose.Schema({...});
connection.model('Program', ProgramSchema);

All queries hang and return nothing Program.find() will just hang

Fixed if I downgrade to mongoose@4.6.6 The change in 4.7.7 is a dependency version update muri@1.1.1 to muri@1.2.0. I am guessing that is was is causing the issue

Please mention your node.js, mongoose and MongoDB version. mongoose 4.7.7 node 6.9.2 MongoDB 3.2.3

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 10
  • Comments: 30 (6 by maintainers)

Most upvoted comments

@gfzabarino maybe they were upgrading from 4.6.6.

At our team, we have the same issue: 4.7.7 causes high CPU and increased RAM usage. After having downgraded to 4.7.6 the problem is solved.

@sitegui I can confirm that. I’ve had forked the mongoose and downgraded mongodb to 2.2.16 in it, then changed our project’s dependency to use my fork. It worked without any problems.

@vkarpov15 is it possible to temporarily downgrade the mongodb version to 2.2.16 until the mongodb issue gets sorted out? Thank you in advance.

Confirmed, we have the same issue, after upgraded to 4.7.7, server pm2 process will be 100% CPU usage: screen shot 2017-01-22 at 09 17 18

we are trying to trace this with strace on our server, step by step to positioning this problem, and finally confirmed caused by mongoose, this is the system call status when this happening, very like an infinite loop: screen shot 2017-01-21 at 16 51 57

we are using MongoDB HA mode with replica set failover, the connection URI like:

mongodb://***:****@ze1a3dbb36ef5642.xxx.net:3717,ze1a3dbb36ef5641.xxx.net:3717/admin?replicaSet=mgset-1405217

after we go back to 4.6.6, thanks @dariiiannn : screen shot 2017-01-22 at 09 30 05

Maybe related to https://github.com/christkv/mongodb-core/issues/156, i think mongodb 2.2.22 fixes it, well apparantly not entirely. Indeed it’s related to mongodb >=2.2.17 in combo with replication

Another point is the process is not completely not working, it’s working but very slow until cpu to 100%, then the process died.

@sonicgao same problem here getting same results, actually i noticed that the app freezes after 2 hours even on high cpu instances

Unfortunately we can’t reproduce it (yet) by running tests locally, only after deploying our service to our staging environment.

Happening to me as well. Maybe you meant switching to 4.7.6 @dariiiannn?

This is also happening to me.