trivago/parallel-webpack

CTRL-C with `--max-retries=0` doesn't kill all processes

Opened this issue · 3 comments

I'm running four webpack builds in parallel and occasionally have to terminate early by pressing CTRL-C.

When I press CTRL-C, I see the output about forcefully shutting down the child processes, but the main process stays alive and hangs without exiting. I need to press CTRL-C 1-2 more times to kill everything. I can verify that --max-retries=0 is getting correctly passed in. FWIW, one of my builds finishes rather quickly and the other three are longer running, so usually the SIGINT is sent after the first one is complete. Looks like if I CTRL-C quick enough before any builds have finished, the processes all terminate as expected.

Here is some example output from CTRL-C'ing later in the build:

^C[WEBPACK] Forcefully shutting down

(node:38167) Warning: a promise was rejected with a non-error: [object Object]
[WEBPACK] Build failed after 1.783 seconds
(node:38167) Warning: a promise was rejected with a non-error: [object Object]
(node:38167) Warning: a promise was rejected with a non-error: [object Object]
[WEBPACK] Forcefully shut down [name].js
CSPEER:(myBranch ⚡)$ events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: channel closed
    at process.target.send (internal/child_process.js:540:16)
    at callback (/Users/cspeer/repos/my-repo/node_modules/worker-farm/lib/child/index.js:29:17)
    at process.shutdownCallback (/Users/cspeer/repos/my-repo/node_modules/parallel-webpack/src/webpackWorker.js:96:17)
    at emitNone (events.js:86:13)
    at process.emit (events.js:185:7)
    at Signal.wrap.onsignal (internal/process.js:199:44)

CSPEER:(myBranch ⚡)$ events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: channel closed
    at process.target.send (internal/child_process.js:540:16)
    at callback (/Users/cspeer/repos/my-repo/node_modules/worker-farm/lib/child/index.js:29:17)
    at process.shutdownCallback (/Users/cspeer/repos/my-repo/node_modules/parallel-webpack/src/webpackWorker.js:96:17)
    at emitNone (events.js:86:13)
    at process.emit (events.js:185:7)
    at Signal.wrap.onsignal (internal/process.js:199:44)
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: channel closed
    at process.target.send (internal/child_process.js:540:16)
    at callback (/Users/cspeer/repos/my-repo/node_modules/worker-farm/lib/child/index.js:29:17)
    at process.shutdownCallback (/Users/cspeer/repos/my-repo/node_modules/parallel-webpack/src/webpackWorker.js:96:17)
    at emitNone (events.js:86:13)
    at process.emit (events.js:185:7)
    at Signal.wrap.onsignal (internal/process.js:199:44)

This is more of an annoyance than anything else most of the time, but sometimes results in stray processes left running. Not sure if this is an issue with worker farm or parallel-webpack's own worker management.

this might be related to #57

Hello! Was this issue solved somehow?

@lubomir-chatoryiskyi Unfortunately not at he moment. It will be fixed when we release 3.0.0