Unitech / Unitech/pm2

SIGABRT wrong exit code

Open
#5,994 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

When the process is killed by the heap limiter, the exit code is incorrectly shown as 0.

Steps to reproduce

Create a test.js file:

const numbers = [];
for (let i = 0; i < 100000000; i++) {
  numbers.push(i);
  if (i % 10000 === 0) console.log(i);
}

Execute the following command to trigger the heap limiter:

pm2 start test.js --no-autorestart --no-daemon --node-args="--max-old-space-size=10"

Expected behaviour

The process should exit with SIGABRT signal and a non-zero code (usually 134).

Actual behaviour

The process exits with SIGABRT signal and 0 code. This makes it impossible to determine whether the process exited normally or with an error:

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the pm2 start command path and trace how the child process's SIGABRT status becomes the reported exit code. Reproduce the issue using the provided test.js and --max-old-space-size=10 command; done means SIGABRT is reported with a non-zero exit code such as 134.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.