sbt / sbt-less

Other
43 stars 39 forks source link

Less compilation with node is stuck #79

Open anfuerer opened 8 years ago

anfuerer commented 8 years ago

We have a project with a large number of .less files compiled with sbt-less 1.1.1. The less compilation using node or Trireme worked quite well for a while. One of the reason why the number of .less files is that high is that we have organized the less files in a structure with multiple themes which we all want to compile during a deployment.

Since we recently added new .less files with new themes we are now stuck with the less compilation. The node processes don't terminate. Testing on my machine (Mid 2015 MacBook Pro) the less compilation forks 9 node processes, each of them running with high CPU load for about 10 seconds. Then the node processes go down to 0% CPU and then are stuck forever. The less compilation does not terminate.

I have a sample Play project where this can be reproduced. I currently don't want to share it publicly, but I'm happy to add members to the private Github repo if someone wants to reproduce the issue.

If we remove the number of less files then the issue disappears again. I also noticed that if I set JsEngineKeys.parallelism := 20 then the less compilation works again and all node processes terminate after less then 10 seconds. The compilation time itself doesn't seem to be the issue.

My suspicion is that the amount of files per node process... or maybe the length of the arguments passed to the node process makes the difference. I checked whether there are any limitations on process.argv in node.js, but couldn't find any hint or documentation.

huntc commented 8 years ago

Do you have the same problem using less outside of sbt-web?

anfuerer commented 8 years ago

Sorry for the delayed response.

I got the the process arguments by using ps on one of the stuck node processes from an sbt-less build. If I run this manually I get a SyntaxError. The syntax error seems to be related to the argument handling.

node /Users/uxlemin/Documents/projects/lessc-issue/project/target/less/sbt-less-1.1.1.jar [["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-booking.less","stylesheets/themes/theme3/css/ns-platform-booking.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-contest.less","stylesheets/themes/theme3/css/ns-platform-contest.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-conversations.less","stylesheets/themes/theme3/css/ns-platform-conversations.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-documentation.less","stylesheets/themes/theme3/css/ns-platform-documentation.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-error.less","stylesheets/themes/theme3/css/ns-platform-error.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-explore-detail.less","stylesheets/themes/theme3/css/ns-platform-explore-detail.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-explore.less","stylesheets/themes/theme3/css/ns-platform-explore.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-iam.less","stylesheets/themes/theme3/css/ns-platform-iam.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-iframe.less","stylesheets/themes/theme3/css/ns-platform-iframe.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-index-b2b.less","stylesheets/themes/theme3/css/ns-platform-index-b2b.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-index.less","stylesheets/themes/theme3/css/ns-platform-index.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-landing-page-bow.less","stylesheets/themes/theme3/css/ns-platform-landing-page-bow.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-landing-page-component.less","stylesheets/themes/theme3/css/ns-platform-landing-page-component.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-newsfeeds.less","stylesheets/themes/theme3/css/ns-platform-newsfeeds.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-partners.less","stylesheets/themes/theme3/css/ns-platform-partners.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-print-stylesheet.less","stylesheets/themes/theme3/css/ns-platform-print-stylesheet.less"],["/Users/uxlemin/Documents/projects/lessc-issue/app/assets/stylesheets/themes/theme3/css/ns-platform-search.less","stylesheets/themes/theme3/css/ns-platform-search.less"]] /Users/uxlemin/Documents/projects/lessc-issue/target/web/less/main {"sourceMapRootpath":"","modifyVars":null,"silent":false,"verbose":true,"sourceMapFileInline":false,"relativeImports":true,"color":false,"paths":["/Users/uxlemin/Documents/projects/lessc-issue/app/assets","/Users/uxlemin/Documents/projects/lessc-issue/target/web/jshint/main","/Users/uxlemin/Documents/projects/lessc-issue/target/web/less/main","/Users/uxlemin/Documents/projects/lessc-issue/target/web/coffeescript/main","/Users/uxlemin/Documents/projects/lessc-issue/public","/Users/uxlemin/Documents/projects/lessc-issue/target/web/web-modules/main/webjars","/Users/uxlemin/Documents/projects/lessc-issue/target/web/node-modules/main/webjars","/Users/uxlemin/Documents/projects/lessc-issue/node_modules"],"relativeUrls":false,"strictUnits":false,"optimization":1,"strictImports":false,"maxLineLen":-1,"compress":true,"cleancssOptions":"","rootpath":"","sourceMap":true,"cleancss":false,"sourceMapLessInline":false,"insecure":false,"strictMath":false,"ieCompat":true,"globalVars":null}

The error:

SyntaxError: Unexpected token /
    at Object.parse (native)
    at /Users/uxlemin/Documents/projects/lessc-issue/project/target/less/sbt-less-1.1.1.jar:25:35
    at Object.<anonymous> (/Users/uxlemin/Documents/projects/lessc-issue/project/target/less/sbt-less-1.1.1.jar:148:3)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:136:18)
    at node.js:972:3
rui-ferreira commented 8 years ago

It's happening the same to me, since I added some new LESS files. I have 23 now. Sometimes it works, sometimes it just hangs.

alexflav23 commented 8 years ago

Hi @huntc,

Any updates on this or suggested fixes?

Regards,

pikilon commented 7 years ago

I am having the very same problem, I am running a 64 bit windows 10 and Less block the whole build. Tried on ubuntu bash (in windows) and worked.

Maybe the sbt in 32 bits has something to do with it. I don't even know what to do, install LInux only because this issue it seems radical to me.

rethab commented 7 years ago

We also had this issue again. Doubling the parallelism helped however eventually we want to move away from this and do the less compilation separately.

mkurz commented 9 months ago

I just released version 1.5.0 and 2.0.0, both upgrade to a major sbt-web and sbt-js-engine release, which were refactored a bit. It's not unlikely these two version fix this problem.