Server got 100% CPU when using Meteor.call (only on production)

Hi all.

I’m trying to deploy Meteor app, but I always get 100% CPU when use Meteor.call and never down

My setup:

  • meteor create simple-todos

  • Add methods to server/main.js

Meteor.methods({
    'test': function() {
        console.log('test');
        return null;
    }
});
  • client/main.js
Template.hello.events({
  'click button'(event, instance) {
    // increment the counter when button is clicked
    Meteor.call('test');
  },
});
  • meteor build .. --server-only

  • cd bundle/programs/server

  • npm install

  • export ROOT_URL, PORT, MONGO_URL

  • node main.js

When I clicked to button, server console write test and CPU come 100%.

Thank you.

Meteor.call is asynchronous. You’d have to bindEnvironment to get it to wait. Nothing in those code snippets would worry me unduly although not sure why you are returning a null. I am guessing/hoping :slight_smile: that it isn’t production code. Probably we need more info. I guess also that that may be difficult.

What version of meteor is this and what versions of node and npm do you have in production?

This is because you most likely have node 5 or 6 and not 4.4.7 or 4.6.1. (the recommended ones), many other people had the same issue.

1 Like

You saved my life. Thank you @diaconutheodor

I have the same problem , even though i downgraded my node versions 4.6.1 nothing changed still cpu stuck at 100% or higher for node process. I also tried 4.4.7 nothing changed :confused: .

are you absolutely sure you downgraded ? how did you downgrade ? How are you running meteor ?

I used nvm . then nvm install 4.6.1 . after that i used node -v command and got 4.6.1
I am running meteor just building localy and uploading tar.gz file to server then unpacking with tar command ,
then i run sudo node main.js command .
Also i dont have any user right now . If i go to website and login , after subscriptions initialized cpu goes to 100% and stays there.
In database there are only 10 to 20 data .

My server is centos 6

Okay after i fallowed command at this post Error while updating to Meteor 1.4 cpu usage down to nothing :slight_smile: