amireh / happypack

Happiness in the form of faster webpack build times.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hang build on Windows

Tom910 opened this issue · comments

Hangs on Windows, all node processes hanging to 0% CPU usage. At the same time, on Mac OS very well. The project is large, more than 5000 modules webpack

How can I get the error logs in the node?

happypack@2.2.1, configuration like examples/webpack2-extract-react

You should be able to set the verbose and debug options to true when you configure happypack and then it will output much more information to the console.

@amireh I have included this mode. And he did not show anything new. there is the creation of modules and randomly place all the freezes and progression can not be extended. I checked on 4+ Windows computers.

Tried to disable cache, threadPool, does not help.
If you run only one instance happypack, going normally. With 2+ freezes.

@Tom910 I looked at this today on Windows 7 using Node.js 6.5.0 (installed directly from https://nodejs.org) and the examples that use multiple happypack plugins are all working:

  1. https://github.com/amireh/happypack/blob/master/examples/webpack2-extract-react/webpack.config.js
  2. https://github.com/amireh/happypack/blob/master/examples/transform-loader/webpack.config.js

The first one uses a shared thread pool, while the second doesn't. I'm thinking this is probably related to your config. Can you share that config (or the parts where happypack is involved) with us?

@amireh Config like https://github.com/amireh/happypack/blob/master/examples/webpack2-extract-react/webpack.config.js .
In the examples above problem is not repeated. Repeats in a large project, where 5000+ webpack modules.

Hmm, that makes it a little difficult. I will try compiling the only big project I have access to on Windows but it's not as big as yours (~3k modules) and hope I can reproduce the issue.

Curious, how long does the build usually take without happypack?

~200 seconds in dev mode. With cache and restart. The first time even much more)

I can't weigh in on a solution for the root cause but I can say that I've been having the same problem as well and was able to fix it by upping the number of threads for HappyPack.

The hanging was caused specifically when building our tests. We use karma with a script that dynamically pulls in all our tests into one large bundle (probably several hundred modules, with the tests being fairly sizeable). Locally on my fairly beefy Windows machine (4790k 4GHz i7, 16 GB RAM, SSD) it would only hang if I didn't partially prepopulate the cache by building the source files first. However on our CI machine (also Windows) it would hang every time, even with a partially prepopulated cache. The CI machine is probably a bit less beefy specs-wise and is shared across multiple builds. The takeaway seems to be that system performance/utilization plus the number of imported modules are directly related to whether the build hangs or not. Thankfully, in my case I was able to get it to work consistently without hanging by changing the number of threads from 2 to 4.

We're using a config similar to the ForkTSChecker/ts-loader config example: https://github.com/amireh/happypack/blob/master/examples/ts-loader--webpack2/webpack.config.js

This should (hopefully) be fixed in 4.0.0-beta.4 - can you try that and confirm?

commented

Used 4.0.0-beta.1 back when it was released and it was hanging constantly for me so I reverted to pre-beta. Currently I'm using 4.0.0-beta.5 and I can say I haven't had any hanging as of yet. So I think it's fixed 👍

On my machine it hanged (during initialization) with node 6.0.0 but does not hang with 8.4.0 - so there are node issues to consider as well

@Knagis can you try node 6 with 4.0.0-beta.5? I think it should be fixed for all node versions

I did try 4.0.0-beta5 only with node 6.0.0 and it did not work. I did not try with 6.latest. But from what I investigated, it was a node bug, because fork() did not start the process at all, it wasn't about messaging the child process.

Official release happypack@4.0.0 is out on NPM now and should have the patch for this issue. I'll be closing this but feel free to re-open if the issue pops up again (or open another one.)

Thanks to everyone for troubleshooting.

I am getting the hang on 4.0.0

lerna info version 2.1.2
lerna info scope @sstk/browser-bios
@sstk/browser-bios: > @sstk/browser-bios@0.49.0 build /home/dfenster/code/sstk/packages/browser-bios
@sstk/browser-bios: > UV_THREADPOOL_SIZE=100 webpack
@sstk/browser-bios: Happy[jsx]: Version: 4.0.0. Threads: 5 (shared pool)
@sstk/browser-bios: Happy[jsx]: All set; signaling webpack to proceed.
@sstk/browser-bios: Happy[stylecss]: Version: 4.0.0. Threads: 5 (shared pool)
@sstk/browser-bios: Happy[stylecss]: All set; signaling webpack to proceed.

Unfortunately we still see this behavior at CodeSandbox. Tried with both 4.0.0 and 4.0.1. Linux & MacOS work just fine.

@amireh If you're interested in looking into this, please let me know, so I can give you more details about my environment and the steps to reproduce it. I'd do it myself, but I haven't got the slightest idea of what to look at, if you could guide me a bit, that'd also be appreciated. Thanks!

My issue resolved itself with Windows Update a couple months back.

What Windows version? I'm on an up-to-date Windows 7 Ultimate.

Windows 10 through WSL

Update: sometimes it just hangs, sometimes I get this just before it hangs:

undefined:1

^

SyntaxError: Unexpected token  in JSON at position 0
    at JSON.parse (<anonymous>)
    at Pipe.channel.onread (internal/child_process.js:480:28)