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

Handle Signals #171

Merged
merged 3 commits into from
Jun 5, 2019
Merged

Handle Signals #171

merged 3 commits into from
Jun 5, 2019

Conversation

wyattjoh
Copy link
Contributor

We discovered an issue where npm-run-all swallows errors caused by the v8 runtime, specifically, the SIGABRT signal sent when the node process experiences a JavaScript heap out of memory error.

From the documentation available https://nodejs.org/api/child_process.html, it indicates that when the process closes, if the code provided is null, then the subprocess terminated due to a signal.

The standard behaviour that NodeJS implements when running code that causes these errors directly is to return an exit code of 128 plus the value of the signal code.

This PR does one thing, checks to see if the code is null, and a signal was provided, convert the signal to it's number version, and then mutates the return code used by the rest of npm-run-all by adding 128 to the signal value.

@codecov
Copy link

codecov bot commented May 29, 2019

Codecov Report

Merging #171 into master will decrease coverage by 0.36%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #171      +/-   ##
==========================================
- Coverage   92.94%   92.58%   -0.37%     
==========================================
  Files          22       22              
  Lines         468      472       +4     
==========================================
+ Hits          435      437       +2     
- Misses         33       35       +2
Impacted Files Coverage Δ
lib/run-task.js 86.76% <100%> (ø) ⬆️
lib/run-tasks.js 83.09% <50%> (-1.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5017a88...d293933. Read the comment docs.

@mysticatea
Copy link
Owner

Thank you for this PR. I had not noticed the second parameter.

Generally LGTM, but the signal-numbers package has been deprecated. Would you know another option?

@wyattjoh
Copy link
Contributor Author

wyattjoh commented Jun 3, 2019

Good point about the signal-numbers package, but thankfully, those codes won't change for a long time, so I'd think this would be good for now as I couldn't find another package that did the same thing.

@mysticatea
Copy link
Owner

Well, in that case, I want to have that numbers in itself instead of using the package.

Because I have experienced malicious code injection via inactive packages (#149), I want not to use deprecated packages.

@wyattjoh
Copy link
Contributor Author

wyattjoh commented Jun 4, 2019

Not a problem! I've addressed the fix @mysticatea!

Copy link
Owner

@mysticatea mysticatea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you very much!

@mysticatea mysticatea merged commit b2260f5 into mysticatea:master Jun 5, 2019
@n9niwas
Copy link

n9niwas commented Sep 8, 2021

is there a plan to release this?

latest version in npm doesn't have this fix

tksst added a commit to tksst/next-app-additions that referenced this pull request Dec 6, 2023
The latest release of npm-run-all does not fix this bug: mysticatea/npm-run-all#171
tksst added a commit to tksst/next-app-additions that referenced this pull request Dec 6, 2023
The latest release of npm-run-all does not fix this bug: mysticatea/npm-run-all#171
tksst added a commit to tksst/typescript-starter-template that referenced this pull request Dec 9, 2023
The latest release of npm-run-all does not fix this bug: mysticatea/npm-run-all#171
tksst added a commit to tksst/eslint-config that referenced this pull request Dec 9, 2023
The latest release of npm-run-all does not fix this bug: mysticatea/npm-run-all#171
tksst added a commit to tksst/cdk-ec2-spot-simple that referenced this pull request Dec 9, 2023
The latest release of npm-run-all does not fix the signaling handling bug: mysticatea/npm-run-all#171
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants