trivago / parallel-webpack

Builds multi-config webpack projects in parallel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

some childprocesses don't get killed when quitting

ctaepper opened this issue · comments

in a current project of mine, i have 12 builds running in watch mode. every now and then, when i quit watch mode (ctrl+c), some of the child processes keep staying alive, leading to a couple of them running at the end of the day.

now that i am aware of this, i kill them manually each time i stop watch mode, but obviously, that should not be the way to handle that.

can i change anything in my setup to prevent this in the first place? are there any known bugs unfortunately i cannot share any project details...

Edit: Using latest version 1.6.1

here an example:

[WEBPACK 16:55:59] Finished building client-cp-forms.uk-ua.min.js within 1.834 seconds
[WEBPACK 16:55:59] Finished building client-cp-forms.de.min.js within 1.853 seconds
[WEBPACK 16:55:59] Finished building client-cp-forms.dk.min.js within 1.954 seconds
[WEBPACK 16:56:00] Finished building client-cp-forms.es.min.js within 2.189 seconds
[WEBPACK 16:56:00] Finished building client-cp-forms.uk-ua.mock.min.js within 2.02 seconds
[WEBPACK 16:56:00] Finished building client-cp-forms.ru-ua.min.js within 2.316 seconds
[WEBPACK 16:56:00] Finished building client-cp-forms.ru-ua.mock.min.js within 2.103 seconds
[WEBPACK 16:56:00] Finished building client-cp-forms.dk.mock.min.js within 2.126 seconds
[WEBPACK 16:56:00] Finished building client-cp-forms.it.mock.min.js within 2.25 seconds
[WEBPACK 16:56:00] Finished building client-cp-forms.es.mock.min.js within 2.3 seconds
[WEBPACK 16:56:00] Finished building client-cp-forms.de.mock.min.js within 2.151 seconds
^C[WEBPACK] Forcefully shutting down
Worker Farm: Received message for unknown index for existing child. This should not happen!

Worker Farm: Received message for unknown index for existing child. This should not happen!
Worker Farm: Received message for unknown index for existing child. This should not happen!
Worker Farm: Received message for unknown index for existing child. This should not happen!
Worker Farm: Received message for unknown index for existing child. This should not happen!                                                                                                                                                                                                                                                                                                                                                                                                    
Worker Farm: Received message for unknown child. This is likely as a result of premature child death, the operation will have been re-queued.
Worker Farm: Received message for unknown child. This is likely as a result of premature child death, the operation will have been re-queued.
Worker Farm: Received message for unknown index for existing child. This should not happen!
➜  client__cp2-backend git:(feature/rollout-ukraine) ✗ [WEBPACK] Started watching client-cp-forms.ru-ua.mock.min.js
[WEBPACK] Started watching client-cp-forms.uk-ua.mock.min.js
[WEBPACK] Started watching client-cp-forms.uk-ua.min.js
[WEBPACK] Started watching client-cp-forms.ru-ua.min.js
[WEBPACK] Started watching client-cp-forms.it.mock.min.js
[WEBPACK] Started watching client-cp-forms.it.min.js

➜  client__cp2-backend git:(feature/rollout-ukraine) ✗ 
➜  client__cp2-backend git:(feature/rollout-ukraine) ✗ 
➜  client__cp2-backend git:(feature/rollout-ukraine) ✗ [WEBPACK 08:24:52] Finished building client-cp-forms.uk-ua.mock.min.js within 19.258 seconds
[WEBPACK 08:25:03] Finished building client-cp-forms.ru-ua.min.js within 30.29 seconds
[WEBPACK 08:25:04] Finished building client-cp-forms.uk-ua.min.js within 30.501 seconds
[WEBPACK 08:25:15] Finished building client-cp-forms.it.mock.min.js within 41.973 seconds
[WEBPACK 08:25:15] Finished building client-cp-forms.ru-ua.mock.min.js within 42.183 seconds
[WEBPACK 08:25:15] Finished building client-cp-forms.it.min.js within 42.176 seconds
➜  client__cp2-backend git:(feature/rollout-ukraine) ✗ 

and these are my left over processes which i have to kill manually

57706 ttys001    0:35.27 /Users/ct/.nvm/versions/node/v5.1.1/bin/node /Users/ct/Projekte/client__cp2-backend/node_modules/worker-farm/lib/child/index.js
57713 ttys001    0:31.78 /Users/ct/.nvm/versions/node/v5.1.1/bin/node /Users/ct/Projekte/client__cp2-backend/node_modules/worker-farm/lib/child/index.js
57717 ttys001    0:21.48 /Users/ct/.nvm/versions/node/v5.1.1/bin/node /Users/ct/Projekte/client__cp2-backend/node_modules/worker-farm/lib/child/index.js
93937 ttys001    0:01.33 node /Users/ct/Projekte/client__cp2-backend/node_modules/.bin/parallel-webpack --config frontend/forms/webpack/dev.js --no-stats --watch

as you can see, this project is using node 5.x... maybe related to that?

It looks as if the watcher just restarts even though the processes were killed. Might be a duplicate of #29

Could you try using the https://github.com/trivago/parallel-webpack#specifying-retry-limits option to see if that helps?

ok, so i tried max-retries=3

➜  client__cp2-backend git:(feature/rollout-sweden) ✗ npm run dev-forms

> client__cp2-backend@1.11.1 dev-forms /Users/ct/Projekte/client__cp2-backend
> parallel-webpack --config frontend/forms/webpack/dev.js --no-stats --watch --max-retries=3

[WEBPACK] Building 12 targets
[WEBPACK] Started watching client-cp-forms.es.min.js
[WEBPACK] Started watching client-cp-forms.es.mock.min.js
[WEBPACK] Started watching client-cp-forms.de.min.js
[WEBPACK] Started watching client-cp-forms.dk.min.js
[WEBPACK] Started watching client-cp-forms.dk.mock.min.js
[WEBPACK] Started watching client-cp-forms.de.mock.min.js
[WEBPACK] Started watching client-cp-forms.it.min.js
[WEBPACK] Started watching client-cp-forms.se.min.js
[WEBPACK] Started watching client-cp-forms.gb.min.js
[WEBPACK] Started watching client-cp-forms.se.mock.min.js
[WEBPACK] Started watching client-cp-forms.it.mock.min.js
[WEBPACK] Started watching client-cp-forms.gb.mock.min.js
[WEBPACK 09:16:31] Finished building client-cp-forms.es.min.js within 24.713 seconds
[WEBPACK 09:16:31] Finished building client-cp-forms.gb.min.js within 24.688 seconds
[WEBPACK 09:16:32] Finished building client-cp-forms.gb.mock.min.js within 25.466 seconds
[WEBPACK 09:16:32] Finished building client-cp-forms.es.mock.min.js within 25.676 seconds
[WEBPACK 09:16:44] Finished building client-cp-forms.se.min.js within 37.626 seconds
[WEBPACK 09:16:44] Finished building client-cp-forms.de.min.js within 37.828 seconds
[WEBPACK 09:16:44] Finished building client-cp-forms.dk.min.js within 37.942 seconds
[WEBPACK 09:16:44] Finished building client-cp-forms.it.min.js within 38.132 seconds
[WEBPACK 09:16:45] Finished building client-cp-forms.se.mock.min.js within 39.059 seconds
[WEBPACK 09:16:46] Finished building client-cp-forms.dk.mock.min.js within 39.206 seconds
[WEBPACK 09:16:46] Finished building client-cp-forms.de.mock.min.js within 39.354 seconds
[WEBPACK 09:16:46] Finished building client-cp-forms.it.mock.min.js within 39.603 seconds
^C[WEBPACK] Forcefully shutting down
Worker Farm: Received message for unknown index for existing child. This should not happen!
Worker Farm: Received message for unknown index for existing child. This should not happen!
Worker Farm: Received message for unknown index for existing child. This should not happen!
Worker Farm: Received message for unknown index for existing child. This should not happen!

Worker Farm: Received message for unknown child. This is likely as a result of premature child death, the operation will have been re-queued.
Worker Farm: Received message for unknown child. This is likely as a result of premature child death, the operation will have been re-queued.
Worker Farm: Received message for unknown child. This is likely as a result of premature child death, the operation will have been re-queued.
Worker Farm: Received message for unknown child. This is likely as a result of premature child death, the operation will have been re-queued.
➜  client__cp2-backend git:(feature/rollout-sweden) ✗ [WEBPACK] Started watching client-cp-forms.se.min.js
[WEBPACK] Started watching client-cp-forms.se.mock.min.js
[WEBPACK] Started watching client-cp-forms.it.min.js
[WEBPACK 09:17:27] Finished building client-cp-forms.se.min.js within 10.233 seconds
[WEBPACK 09:17:35] Finished building client-cp-forms.se.mock.min.js within 17.852 seconds
[WEBPACK 09:17:35] Finished building client-cp-forms.it.min.js within 18.16 seconds

➜  client__cp2-backend git:(feature/rollout-sweden) ✗

so, quitting with max-retries=3 left me with the following rogue processes.

~ ps -ax | grep cp2
31757 ttys001    0:00.94 node /Users/ct/Projekte/client__cp2-backend/node_modules/.bin/parallel-webpack --config frontend/forms/webpack/dev.js --no-stats --watch --max-retries=3
32177 ttys001    0:18.34 /Users/ct/.nvm/versions/node/v5.1.1/bin/node /Users/ct/Projekte/client__cp2-backend/node_modules/worker-farm/lib/child/index.js
32180 ttys001    0:12.36 /Users/ct/.nvm/versions/node/v5.1.1/bin/node /Users/ct/Projekte/client__cp2-backend/node_modules/worker-farm/lib/child/index.js
32246 ttys002    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn cp2

even when setting max-retries=1

➜  client__cp2-backend git:(feature/rollout-sweden) ✗ npm run dev-forms

> client__cp2-backend@1.11.1 dev-forms /Users/ct/Projekte/client__cp2-backend
> parallel-webpack --config frontend/forms/webpack/dev.js --no-stats --watch --max-retries=1

[WEBPACK] Building 12 targets
[WEBPACK] Started watching client-cp-forms.de.mock.min.js
[WEBPACK] Started watching client-cp-forms.de.min.js
[WEBPACK] Started watching client-cp-forms.dk.min.js
[WEBPACK] Started watching client-cp-forms.es.mock.min.js
[WEBPACK] Started watching client-cp-forms.dk.mock.min.js
[WEBPACK] Started watching client-cp-forms.es.min.js
[WEBPACK] Started watching client-cp-forms.gb.min.js
[WEBPACK] Started watching client-cp-forms.gb.mock.min.js
[WEBPACK] Started watching client-cp-forms.it.min.js
[WEBPACK] Started watching client-cp-forms.it.mock.min.js
[WEBPACK] Started watching client-cp-forms.se.min.js
[WEBPACK] Started watching client-cp-forms.se.mock.min.js
[WEBPACK 09:19:09] Finished building client-cp-forms.gb.min.js within 20.986 seconds
[WEBPACK 09:19:10] Finished building client-cp-forms.es.min.js within 21.571 seconds
[WEBPACK 09:19:10] Finished building client-cp-forms.gb.mock.min.js within 22.198 seconds
[WEBPACK 09:19:11] Finished building client-cp-forms.es.mock.min.js within 22.506 seconds
[WEBPACK 09:19:21] Finished building client-cp-forms.de.mock.min.js within 33.282 seconds
[WEBPACK 09:19:21] Finished building client-cp-forms.de.min.js within 33.361 seconds
[WEBPACK 09:19:22] Finished building client-cp-forms.it.mock.min.js within 33.435 seconds
[WEBPACK 09:19:22] Finished building client-cp-forms.it.min.js within 33.52 seconds
[WEBPACK 09:19:22] Finished building client-cp-forms.se.min.js within 33.65 seconds
[WEBPACK 09:19:22] Finished building client-cp-forms.dk.min.js within 33.899 seconds
[WEBPACK 09:19:23] Finished building client-cp-forms.dk.mock.min.js within 34.591 seconds
[WEBPACK 09:19:23] Finished building client-cp-forms.se.mock.min.js within 34.803 seconds
^C[WEBPACK] Forcefully shutting down
Worker Farm: Received message for unknown index for existing child. This should not happen!
Worker Farm: Received message for unknown index for existing child. This should not happen!
Worker Farm: Received message for unknown index for existing child. This should not happen!
Worker Farm: Received message for unknown index for existing child. This should not happen!

Worker Farm: Received message for unknown child. This is likely as a result of premature child death, the operation will have been re-queued.
Worker Farm: Received message for unknown child. This is likely as a result of premature child death, the operation will have been re-queued.
Worker Farm: Received message for unknown child. This is likely as a result of premature child death, the operation will have been re-queued.
Worker Farm: Received message for unknown child. This is likely as a result of premature child death, the operation will have been re-queued.
[WEBPACK] Build failed after 50.627 seconds
cancel after 1 retries!
➜  client__cp2-backend git:(feature/rollout-sweden) ✗ [WEBPACK] Started watching client-cp-forms.se.min.js
[WEBPACK 09:19:49] Finished building client-cp-forms.se.min.js within 10.129 seconds

➜  client__cp2-backend git:(feature/rollout-sweden) ✗

there is still one process left over

~ ps -ax | grep cp2
32600 ttys001    0:12.49 /Users/ct/.nvm/versions/node/v5.1.1/bin/node /Users/ct/Projekte/client__cp2-backend/node_modules/worker-farm/lib/child/index.js
32997 ttys002    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn cp2

FYI, complete systeminfo
OSX 10.12.3
node.js 5.1.1
npm 3.10.8
parallel-webpack 1.6.1
webpack 1.14.0

so, obviously i was supposed to set max-retries=0 ^^
this did the trick for now, 3 runs without any leftover processes, but if i understand the docs, this leads me to manually restarting the build as soon as i have an error in my code?

No, errors within your actual source code are handled by webpack's watch mode. You'll need to restart if you have an error in the configuration file.

I'll create a feature ticket to make 0 the default value. Other values cause too much confusion.

Thank you for testing this!

alright, thanks!