Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cancelling task doesn't finish child's spawned processes #76

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

cristianoliveira
Copy link
Owner

@cristianoliveira cristianoliveira commented Jun 14, 2023

When the child task also spawns a process, the child.kill() wasn't enough to fully cancel it. By using the unix signal we ensure it will be clean closed before starting the task again.

For instance, jest spawns multiple workers and Funzzy wasn't closing all of them. After this change, it cancels the current jest run properly

user:op-integrator-dashboard/ (feat/pagination-for-merchant-listing) $ ps aux | grep jest                                                                                                                                                       [9:16:01]
user  5046  49.7  0.2 34850360  35308 s035  S+    9:16AM   0:00.22 /usr/local/Cellar/node/20.2.0/bin/node /Users/user/work/op-integrator-dashboard/node_modules/jest-worker/build/workers/processChild.js
user  5047  49.5  0.2 34850360  35504 s035  R+    9:16AM   0:00.22 /usr/local/Cellar/node/20.2.0/bin/node /Users/user/work/op-integrator-dashboard/node_modules/jest-worker/build/workers/processChild.js
user  5049  49.1  0.2 34850360  35284 s035  S+    9:16AM   0:00.22 /usr/local/Cellar/node/20.2.0/bin/node /Users/user/work/op-integrator-dashboard/node_modules/jest-worker/build/workers/processChild.js
user  5045  47.8  0.2 34850360  36104 s035  S+    9:16AM   0:00.23 /usr/local/Cellar/node/20.2.0/bin/node /Users/user/work/op-integrator-dashboard/node_modules/jest-worker/build/workers/processChild.js
user  5048  47.0  0.2 34850360  35188 s035  R+    9:16AM   0:00.22 /usr/local/Cellar/node/20.2.0/bin/node /Users/user/work/op-integrator-dashboard/node_modules/jest-worker/build/workers/processChild.js
user  5051  46.4  0.2 34850360  35740 s035  R+    9:16AM   0:00.22 /usr/local/Cellar/node/20.2.0/bin/node /Users/user/work/op-integrator-dashboard/node_modules/jest-worker/build/workers/processChild.js
user  5050  46.0  0.2 34850360  35340 s035  R+    9:16AM   0:00.22 /usr/local/Cellar/node/20.2.0/bin/node /Users/user/work/op-integrator-dashboard/node_modules/jest-worker/build/workers/processChild.js
user  5008  32.7  0.9 56050952 152792 s035  S+    9:16AM   0:01.26 node /Users/user/work/op-integrator-dashboard/node_modules/.bin/jest --watch --no-watch
user  5075   0.0  0.0 34121332    660 s010  S+    9:16AM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox jest

@cristianoliveira cristianoliveira changed the title fix: cancelling task don't finish the process fix: cancelling task don't finish child's spawned processes Jun 14, 2023
@cristianoliveira cristianoliveira changed the title fix: cancelling task don't finish child's spawned processes fix: cancelling task doesn't finish child's spawned processes Jun 14, 2023
When the child task also spawn a process, the child.kill() wasn't
enough to fully cancel it. By using the unix signal we ensure it will
be clean closed before starting the task again.
@cristianoliveira cristianoliveira merged commit 9aed153 into master Jun 15, 2023
2 checks passed
@cristianoliveira cristianoliveira deleted the feat/close-non-block-child branch March 31, 2024 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant