Note that there are some explanatory texts on larger screens.

plurals
  1. PONode/Mongo application crashes on Amazon EC2 and cannot access the server
    primarykey
    data
    text
    <p>I have a node app with mongo server on an amazon ec2 instance. It works great, but I just added a new API call and every time I call it, the server freezes and I cannot access/ssh into it for several hours. While this is happening, my server goes down which makes the app that relies on it unusable and my users angry...</p> <p><b>This code works perfectly on my localhost</b>, but as soon as I run it on my server it freezes. My thoughts are that it may be crashing mongo? I have no idea why this would happen...</p> <p>If anyone has any ideas what could be going wrong, please let me know.</p> <p>node is using express. The send_error function will perform a res.send({some error}). db.CommentModel returns mongoose.model('comment', Comment);</p> <p>in app.js</p> <pre><code>app.get('/puzzle/comment/:id', auth.restrict, puzzle.getComments); </code></pre> <p>in the file which defines getComments</p> <pre><code>exports.getComments = function(req, res) { var userID = _u.stripNonAlphaNum(req.params.id); var CommentModel = db.CommentModel; CommentModel.find({user: userID}, function(e, comments) { if(e) { err.send_error(err.DB_ERROR, res); } else if (!comments) { err.send_error(err.DB_ERROR, res); } else if (comments.length == 0) { res.send([]); } else { var commentIDs = []; for (var i = 0; i&lt;comments.length; i++) { commentIDs.push({_id: comments[i].puzzle}); } var TargetModel = pApp.findPuzzleModel(_u.stripNonAlphaNum(req.apiKey)); TargetModel.find({removed: false, $or: commentIDs}, function(e, puzzles) { if(e) { err.send_error(err.DB_ERROR, res); } else if (!puzzles) { err.send_error(err.DB_ERROR, res); } else { res.send(puzzles); } }); } }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload