Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8487255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:11:07+00:00 2026-06-10T21:11:07+00:00

I have a node app with mongo server on an amazon ec2 instance. It

  • 0

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…

This code works perfectly on my localhost, 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…

If anyone has any ideas what could be going wrong, please let me know.

node is using express. The send_error function will perform a res.send({some error}). db.CommentModel returns mongoose.model(‘comment’, Comment);

in app.js

app.get('/puzzle/comment/:id', auth.restrict, puzzle.getComments);

in the file which defines getComments

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<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);
                }
            });
        }
    });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:11:09+00:00Added an answer on June 10, 2026 at 9:11 pm

    It sounds like your query is causing something on your server (potentially mongo) to consume a very large amount of CPU – as this is commonly what causes the issue you have seen with SSH access.

    You should try reading over the logs of your mongo instance and seeing if there are any long running queries.

    Monngodb provides an internal profiler for examining long running commands. Try setting long running profiling level to 1, running the command and examining the logfile output.

    More details on the profiler are available at http://www.mongodb.org/display/DOCS/Database+Profiler

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Ubuntu server on linode running a node.js/mongo app. I realize I
I have the following node.js server-side code: var app = require('http').createServer(handler) , io =
I have Node.js installed on a RedHat instance of EC2. I also installed Express
We have a node.js app that uses node_msyql , a great little library for
i am new to heroku and node.js. i have a small node.js app which
I have set a node app up on my server and i can ssh
I have running nginx on my server ansel.ms and a node.js app on ansel.ms:46156.
I'm about ready to go live with my node.js/mongo app running on the Amazon
I have just gotten a VPS to bring my first node.js project online, but
I have the following express node.js app. It's using the 'redis' npm package. app.get(/test,function(req,res){

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.