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

Wrong exit code for out of memory run test suite #645

Closed
eseliger opened this issue Aug 14, 2017 · 2 comments
Closed

Wrong exit code for out of memory run test suite #645

eseliger opened this issue Aug 14, 2017 · 2 comments

Comments

@eseliger
Copy link

Expected Behavior

nyc should exit with return code different from 0

Observed Behavior

It actually doesn't. Although, in my opinion, it should. Because a application that runs out of memory obviously failed and so should nyc. This caused some trouble in our CD pipeline, so it can be dangerous.

Suggestion

Using spawn instead of fork seems not to share the memory and kill nyc as well. As you can see, the output seems to be pretty different for a crashed process, I guess it's distinguishable, so there could be a detection for that.

const spawn = require('child_process').spawnSync;
const p = spawn('node', ['test.js']);
console.log(p.status);
console.log(p.signal);
console.log(p.error);

test.js:

let longArray = [1,2,3,4,5,6,7,8,9,0];
function appendLongArray() {
    longArray = [...longArray, ...longArray];
    appendLongArray();
    // process.exit(1); #2
}
appendLongArray();

Output for out of memory run application is:

null
SIGABRT
undefined

Output for a normal process:

0
null
undefined

Operating System: MacOS 10.12.6
node: 8.2.1
npm: 5.3

@bcoe
Copy link
Member

bcoe commented Sep 16, 2017

@eseliger interesting, I wonder if the module signal-exit module we use to write reports when the application exits might be the culprit.

It might be worth disabling the handling of SIGARBT and seeing whether the issue continues (you could do this by temporarily modifying the signal-exit module in the node-modules folder). I would love some help digging into this if you're so inclined.

@stale stale bot added the wontfix label Jan 6, 2019
@istanbuljs istanbuljs deleted a comment from stale bot Feb 4, 2019
@JaKXz
Copy link
Member

JaKXz commented Feb 4, 2019

Closing in favour of #798. Thanks for the issue! Let me know if you think they should be separate issues

@JaKXz JaKXz closed this as completed Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants