Build application very slow, 100% CPU

I’m just following the official docs for meteor react and trying to get some npm packages going (react-jade). However, changes which cause meteor to rerun basically locks up one of my cores and causes the console to become unresponsive for minutes at a time. I noticed that if I added these packages:

meteorhacks:npm
cosmos:browserify
npm-container

meteor would auto build and get stuck on ‘Build application’ for a very long time…
Anyone else getting this?

Having had a weekend of uphill battles + I don’t think webstorm supports jade in jsx makes me hesitate to migrate now. :frowning:

2 Likes

Can you give us an app reproduction to test with? Curious to run this on my machine.

I’m surprised I was able to reproduce this with my hobby project just by adding a couple of packages, couldn’t share the work one. I’m thinking it’s probably environment related. Running Win 8.1 Pro, 64bit. Thanks for taking a look! :smile:

@sashko to my second surprise today, I was able to reproduce this on my laptop too, win 7 pro 64bit, just by cloning and running the project.

To add to the fun I replicated this on my Ubuntu VM (14.04 64-bit) (@mordrax I cloned your hobby project) . “Top” indicated node was eating all the CPU. Interestingly, CTRL-C failed to kill the process and I had to resort to kill -9.

Edit: I started removing and replacing packages to see which package, if any, was responsible. Removing cosmos:browserify allows the build to run normally (although the app fails to run, obviously).

1 Like

@mordrax can you commit your npm-container package?

OK, confirmed that this does happen on my machine, Mac OS. Going to look into it.

1 Like

Hey, I don’t know if this is the actual issue, but I don’t think react-jade is actually intended to be used on the client. It looks like it is meant to be used as a browserify transform.

Unfortunately, currently there is not a good solution for using browserify to transform files in a Meteor app (only for loading stuff from an NPM package).

So the best solution would be to create a build plugin, similar to the Meteor-provided jsx plugin: https://github.com/meteor/react-packages/blob/master/packages/jsx/jsx-plugin.js

You could package it up and put it on atmosphere for anyone to use if they want to compile Jade files to React.

Thanks for the direction, I think I get what you’re talking about… :confused:, I’m going to give it a go and see what I come up with.
I’m thinking I need to

  1. Replace
var result = Babel.transformMeteor(source, {

on line:6 with the jade transform (keep the other stuff the same)

2.And somehow incorporate react-jade into the package with meteorhack:npm (need research)

3.Lastly, register it with jjsx (Jade jsx),

Yeah that sounds perfect. If you have any questions or run into issues along the way, I’d love to help. Eventually, I’d want to write a tutorial on making build plugins. It’s not terribly hard, and unlocks a lot of value for Meteor.

Just chipping in to say I’ve got this problem too on a totally unrelated project (not React or Jade or JSX or anything). I can build a small package with cosmos-browserify, but if I try to build a package that depends on that package then the build locks up for about a minute or two and I have to kill -9. Removing cosmos-browserify also avoids the problem but obviously fails to build.

Pretty sure it’s a browserify issue, but it’s hard to know where.

I’ve had a lot of issues with it lately. Have you tried Meteor 1.2 RC and the beta of browserify? I know they just released some new stuff for both that are not officially released.

I’ve switched over to webpack-meteor but that’s not exactly turn key with the ES6 modules.

I am having a similar issue.

How to pinpoint the package systematically?

Thanks,

Tian

% METEOR_PROFILE=1 meteor
[[[[[ ~/craftbeer/code/craftbeer ]]]]]

=> Started proxy.
=> Started MongoDB.
| Selecting package versions |
| bundler.readJsImage: 37.2
| files.readFile: 34.7
| other bundler.readJsImage: 2.4
| JsImage#load: 570.4
| other JsImage#load: 569.9
| files.writeFile: 39.6
| Select Package Versions: 10459.8
| new CS.Input: 23.5
| Input#loadFromCatalog (sqlite): 8308.2
| new CS.Solver: 88.1
| Solver#analyze: 87.9
| analyze allowed versions: 8.7
| analyze reachability: 9.1
| analyze constraints: 67.8
| analyze pre-releases: 1.3
| Solver#getAnswer: 2038.7
| new Logic.Solver (MiniSat start-up): 112.1
| require root dependencies: 1.6
| generate package variables: 101.0
| generate dependency requirements: 186.9
| generate constraints: 402.5
| pre-solve: 548.7
| minimize unknown_packages: 2.7
| minimize conflicts: 273.6
| minimize unanticipated_prereleases: 7.3
| calculate previous_root distance costs: 18.6
| minimize previous_root_incompat: 145.9
| minimize previous_root_major: 1.1
| minimize previous_root_minor: 7.6
| minimize previous_root_patch: 9.0
| calculate previous_indirect distance costs: 6.5
| minimize previous_indirect_incompat: 5.2
| minimize previous_indirect_patch: 4.2
| minimize previous_indirect_rest: 2.3
| lock down important versions: 6.9
| minimize new_indirect_minor: 1.1
| minimize total_packages: 182.6
| generate version map: 1.6
| other Solver#getAnswer: 5.7
|
| Input#loadFromCatalog (sqlite): 8308.2
| other JsImage#load: 569.9
| pre-solve: 548.7
| generate constraints: 402.5
| minimize conflicts: 273.6
| generate dependency requirements: 186.9
| minimize total_packages: 182.6
| minimize previous_root_incompat: 145.9
| new Logic.Solver (MiniSat start-up): 112.1
| generate package variables: 101.0
| analyze constraints: 67.8
| files.writeFile: 39.6
| files.readFile: 34.7
| new CS.Input: 23.5
| calculate previous_root distance costs: 18.6
| analyze reachability: 9.1
| minimize previous_root_patch: 9.0
| analyze allowed versions: 8.7
| minimize previous_root_minor: 7.6
| minimize unanticipated_prereleases: 7.3
| lock down important versions: 6.9
| calculate previous_indirect distance costs: 6.5
| other Solver#getAnswer: 5.7
| minimize previous_indirect_incompat: 5.2
| minimize previous_indirect_patch: 4.2
| minimize unknown_packages: 2.7
| other bundler.readJsImage: 2.4
| minimize previous_indirect_rest: 2.3
| generate version map: 1.6
| require root dependencies: 1.6
| analyze pre-releases: 1.3
| minimize previous_root_major: 1.1
| minimize new_indirect_minor: 1.1
| Total: 11100.0
Building for os.linux.x86_32 \

=> Errors prevented startup:

While processing files with templating (for target web.browser):
apps/apk/bundle/programs/web.browser/head.html:1: Expected one of: , ,

While processing files with ecmascript (for target os.linux.x86_32):

apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/transformers/node_modules/uglify-js/test/compress/issue-12.js:9:27:
apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/transformers/node_modules/uglify-js/test/compress/issue-12.js:
setter should have exactly one param (9:27)

apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/json5/test/parse-cases/numbers/negative-noctal.js:1:1:
apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/json5/test/parse-cases/numbers/negative-noctal.js:
Invalid number (1:1)

apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/json5/test/parse-cases/numbers/noctal-with-leading-octal-digit.js:1:
apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/json5/test/parse-cases/numbers/noctal-with-leading-octal-digit.js:
Invalid number (1:0)

apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/json5/test/parse-cases/numbers/noctal.js:1:
apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/json5/test/parse-cases/numbers/noctal.js:
Invalid number (1:0)

apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/json5/test/parse-cases/numbers/positive-noctal.js:1:1:
apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/json5/test/parse-cases/numbers/positive-noctal.js:
Invalid number (1:1)

apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/js-tokens/test/fixtures/errors.js:1:22:
apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/js-tokens/test/fixtures/errors.js:
Unterminated string constant (1:22)

apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/js-tokens/test/fixtures/regex.js:22:3:
apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/js-tokens/test/fixtures/regex.js:
Unexpected token (22:3)
apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/resolve/test/precedence/bbb.js:1:15:
apps/apk/bundle/programs/server/npm/babel-compiler/node_modules/meteor-babel/node_modules/resolve/test/precedence/bbb.js:
Unexpected token (1:15)
apps/apk/bundle/programs/server/npm/webapp/node_modules/connect/node_modules/multiparty/examples/azureblobstorage.js:38:1:
apps/apk/bundle/programs/server/npm/webapp/node_modules/connect/node_modules/multiparty/examples/azureblobstorage.js:
Unexpected token (38:1)

=> Your application has errors. Waiting for file change.

Please ignore this. I got it fixed.