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

[BUG] OOM exit status inconsistent #2103

Closed
howshit opened this issue Nov 2, 2020 · 2 comments
Closed

[BUG] OOM exit status inconsistent #2103

howshit opened this issue Nov 2, 2020 · 2 comments
Labels
Bug thing that needs fixing Release 6.x work is associated with a specific npm 6 release

Comments

@howshit
Copy link

howshit commented Nov 2, 2020

Current Behavior:

We've encountered something weird recently:

We are running a script with docker image node:12.18.3-alpine, the script is causing OOM.

if we run it in "npm run oom" (oom is the script name, and the definition of this script is node scriptFileName.js), the exit code is 0, and if we are running it in "node scriptFileName.js" directly, the exit code is 139.

Expected Behavior:

I think the expected behavior is returning exit code 137.

Steps To Reproduce:

  1. create a script ==> test.js
"use strict";
const list = [];
setInterval(() => {
  const record = new MyRecord();
  list.push(record);
}, 0.000001);
function MyRecord() {
  var x = "hii";
  this.name = x.repeat(100000000);
  this.id = x.repeat(100000000);
  this.account = x.repeat(100000000);
}
setInterval(() => {
  console.log(process.memoryUsage());
}, 100);
  1. create a package.json
{
  "name": "memory_test",
  "version": "1.0.0",
  "description": "",
  "main": "test.js",
  "scripts": {
    "oom": "node --throw-deprecation --max-old-space-size=1 test.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}
  1. run test.js with npm
    docker run --name oom_test -v <same folder with package.json>:/app -it node:12.18.3-alpine sh -c 'cd /app; npm run oom'
  2. run test.js with node
    docker run --name oom_test -v <same folder with package.json>:/app -it node:12.18.3-alpine sh -c 'cd /app; node test.js'
  3. check Exit Code
    docker inspect oom_test |grep ExitCode
    you will find the exit code from step 3 is 0, and exit code from step 4 is 139.

Environment:

  • OS: Linux 4.19.76-linuxkit x86_64
  • Node: 12.18.3
  • npm: 6.14.6
@howshit howshit added Bug thing that needs fixing Needs Triage needs review for next steps Release 6.x work is associated with a specific npm 6 release labels Nov 2, 2020
@howshit howshit closed this as completed Nov 2, 2020
@howshit howshit reopened this Nov 2, 2020
@darcyclarke darcyclarke removed the Needs Triage needs review for next steps label Feb 13, 2021
@darcyclarke
Copy link
Contributor

npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

If your bug is preproducible on v7, please re-file this issue using our new issue template.

If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

Closing: This is an automated message.

@henricook
Copy link

Did you ever get any satisfaction here @howshit ? I've got an OOM from npm run build returning an exit code of 0 at the moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Release 6.x work is associated with a specific npm 6 release
Projects
None yet
Development

No branches or pull requests

3 participants