Meteor/Node Pinning the CPU at 100%

Compiled a small Meteor app with “meteor build”, runs fine, but after the first publish/subscribe is established with a single client, the server CPU gets pinned to 100% forever until the process is restarted. Has anyone seen this before?

I believe it is related to a publish/subscribe. I have a console.log write output on the server when a Meteor publish happens. On the first publish request, the CPU gets pinned 100% forever.

MongoDB is running on the same machine, looks fine, nothing in its logs. Everything should be idle since the database rarely changes. The MongoDB itself never exceeds 1% CPU usage, so I doubt it’s an issue with the data. Feels like an infinite loop somewhere on the server, but it’s not my code!

I installed node-tick-processor to help debug, but not sure what to look for in the resulting log file. There are a lot of ticks mentioning “meteor-promise/fiber_pool.js” and “KeyedStoreIC”.

Meteor version:
OS: Linux CentOS 6

Upon further testing, this appears to occur after ANY client/server communication on a production server running Meteor on Linux CentOS 6 or 7.

To replicate this problem and pin your server’s CPU to 100% forever:

  1. Create a Meteor.method on the server, anything like in server/main.js:

    ‘bar’: function() {
    return “OK”;

  2. meteor build to a directory on a Linux server, do an npm install on the target directory, set the PORT=3000 and ROOT_URL, and run with node main as per the instructions here

  3. Use Chrome browser, connect to the server running on the host (http://my-server:3000). Open the Javascript console, type:'bar') to initiate a simple call from the client to the server.

The server CPU will now be pinned at 100% usage forever until the node process is stopped.

Further details. My meteor packages installed are:

meteor-base@1.0.4             # Packages every Meteor app needs to have
mobile-experience@1.0.4       # Packages for a great mobile UX
mongo@1.1.14                   # The database Meteor supports right now
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
reactive-var@1.0.11            # Reactive variable for tracker
jquery@1.11.10                  # Helpful client-side library
tracker@1.1.1                 # Meteor's client-side reactive programming library

standard-minifier-css@1.3.2   # CSS minifier run for production mode
standard-minifier-js@1.2.1    # JS minifier run for production mode
es5-shim@4.6.15                # ECMAScript 5 compatibility for older browsers.
ecmascript              # Enable ECMAScript2015+ syntax in app code
shell-server@0.2.1            # Server-side component of the `meteor shell` command


And, my package.json dependencies is as follows:

  "dependencies": {
    "babel-runtime": "6.18.0",
    "evil-icons": "^1.9.0",
    "hammerjs": "^2.0.8",
    "jquery": "^3.1.1",
    "meteor-node-stubs": "~0.2.0",
    "moment": "^2.17.1"

Node version node -v is v6.9.2

npm version npm -v is 3.10.9

FYI, I just tested this on node version 4.6.2, and the CPU usage is fine. So, this appears to be a problem when running a Meteor app with a newer version of Node.

For those wondering how to run an older version of node, I changed
node main
meteor node main
which runs a node version that comes with Meteor. Test the version by typing
node -v
meteor node -v

Also, I just noticed this thread which talks about the issue.

Hope this post helps the developers troubleshoot the issue, as it only starts after doing a client-to-server communication.