Unitech / Unitech/pm2

How to generate core dump file when SIGBUS?

Open
#2,495 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

If reporting a bug, please use the following template.

Expected behaviour

The /etc/security/limits.conf looks below:

* soft    core             unlimited
* soft nofile 655350
* hard nofile 655350
@ec2-user        hard    nproc           655350
@ec2-user        soft    nproc           655350
@root        soft    nproc           655350
@root        hard    nproc           655350

I run ulimit -Sc, and ulimit -Hc in terminal, both get:

unlimited

I want to get a core dump file when SIGBUS happend.

Actual behaviour

No core dump file is generated.

I checked /proc/node pid/limits:

Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             4096                 59351                processes
Max open files            655350               655350               files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       59351                59351                signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us

It looks like Soft Limit Max core file size is 0.

But when I run nohup node xxx.js &. I checked /proc/nohuped node pid/limits:

Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        unlimited            unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             655350               655350               processes
Max open files            655350               655350               files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       59351                59351                signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us

In this way, Soft Limit Max core file size is unlimited!

Steps to reproduce

Write a http server, named app.js. Then start with PM2 and nohup node.
Then check /proc/pid/limits.

Software versions used
OS         : Centos 7 x64
node.js    : 16.9.2
PM2        :  2.0.18
PM2 Log output

Use the command: tail --lines 50 ~/.pm2/pm2.log

2016-11-03 03:31:04: App [ng-remote2ndc] with id [6] and pid [913], exited with code [0] via signal [SIGSEGV]
2016-11-03 03:31:04: App [ng-remote2dc] with id [4] and pid [925], exited with code [0] via signal [SIGSEGV]
2016-11-03 03:31:04: Starting execution sequence in -cluster mode- for app name:ng-remote2ndc id:6
2016-11-03 03:31:04: Starting execution sequence in -cluster mode- for app name:ng-remote2dc id:4
2016-11-03 03:31:04: App name:ng-remote2ndc id:8 disconnected
2016-11-03 03:31:04: App [ng-remote2ndc] with id [8] and pid [936], exited with code [0] via signal [SIGSEGV]
2016-11-03 03:31:04: Starting execution sequence in -cluster mode- for app name:ng-remote2ndc id:8
2016-11-03 03:31:04: App name:ng-remote2ndc id:6 online
2016-11-03 03:31:04: App name:ng-remote2dc id:4 online
2016-11-03 03:31:04: App name:ng-remote2ndc id:8 online
2016-11-03 04:32:36: App name:ng-remote2ndc id:6 disconnected
2016-11-03 04:32:36: App [ng-remote2ndc] with id [6] and pid [1073], exited with code [0] via signal [SIGBUS]
2016-11-03 04:32:36: Starting execution sequence in -cluster mode- for app name:ng-remote2ndc id:6
2016-11-03 04:32:36: App name:ng-remote2ndc id:6 online
2016-11-04 00:02:34: App name:ng-remote2dc id:4 disconnected
2016-11-04 00:02:34: App [ng-remote2dc] with id [4] and pid [1081], exited with code [0] via signal [SIGBUS]
2016-11-04 00:02:34: Starting execution sequence in -cluster mode- for app name:ng-remote2dc id:4
2016-11-04 00:02:34: App name:ng-remote2dc id:4 online
2016-11-04 01:30:41: App name:ng-remote2ndc id:9 disconnected
2016-11-04 01:30:41: App [ng-remote2ndc] with id [9] and pid [967], exited with code [0] via signal [SIGBUS]
2016-11-04 01:30:41: Starting execution sequence in -cluster mode- for app name:ng-remote2ndc id:9
2016-11-04 01:30:41: App name:ng-remote2ndc id:9 online
2016-11-04 09:08:17: App name:ng-remote2dc id:3 disconnected
2016-11-04 09:08:17: App [ng-remote2dc] with id [3] and pid [1009], exited with code [0] via signal [SIGBUS]
2016-11-04 09:08:17: Starting execution sequence in -cluster mode- for app name:ng-remote2dc id:3
2016-11-04 09:08:17: App name:ng-remote2dc id:3 online
2016-11-04 09:30:15: App name:ng-remote2dc id:3 disconnected
2016-11-04 09:30:15: App [ng-remote2dc] with id [3] and pid [9183], exited with code [0] via signal [SIGBUS]
2016-11-04 09:30:15: Starting execution sequence in -cluster mode- for app name:ng-remote2dc id:3
2016-11-04 09:30:15: App name:ng-remote2dc id:3 online
2016-11-04 09:30:18: App name:ng-remote2ndc id:8 disconnected
2016-11-04 09:30:18: App [ng-remote2ndc] with id [8] and pid [1101], exited with code [0] via signal [SIGBUS]
2016-11-04 09:30:18: Starting execution sequence in -cluster mode- for app name:ng-remote2ndc id:8
2016-11-04 09:30:18: App name:ng-remote2ndc id:8 online
2016-11-04 10:16:41: App name:ng-remote2ndc id:6 disconnected
2016-11-04 10:16:41: App [ng-remote2ndc] with id [6] and pid [21873], exited with code [0] via signal [SIGBUS]
2016-11-04 10:16:41: Starting execution sequence in -cluster mode- for app name:ng-remote2ndc id:6
2016-11-04 10:16:41: App name:ng-remote2ndc id:6 online
2016-11-04 10:16:44: App name:ng-remote2dc id:2 disconnected
2016-11-04 10:16:44: App [ng-remote2dc] with id [2] and pid [1023], exited with code [0] via signal [SIGBUS]
2016-11-04 10:16:44: Starting execution sequence in -cluster mode- for app name:ng-remote2dc id:2
2016-11-04 10:16:44: App name:ng-remote2dc id:2 online
2016-11-04 19:54:43: App name:ng-remote2ndc id:8 disconnected
2016-11-04 19:54:43: App [ng-remote2ndc] with id [8] and pid [16500], exited with code [0] via signal [SIGBUS]
2016-11-04 19:54:43: Starting execution sequence in -cluster mode- for app name:ng-remote2ndc id:8
2016-11-04 19:54:43: App name:ng-remote2ndc id:8 online
2016-11-04 19:54:46: App name:ng-remote2dc id:4 disconnected
2016-11-04 19:54:46: App [ng-remote2dc] with id [4] and pid [21968], exited with code [0] via signal [SIGBUS]
2016-11-04 19:54:46: Starting execution sequence in -cluster mode- for app name:ng-remote2dc id:4
2016-11-04 19:54:46: App name:ng-remote2dc id:4 online

cf CONTRIBUTING.md for more informations

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

Reproduce the issue with the mentioned app.js server, comparing PM2 and nohup node. Start by checking /proc//limits and the PM2 log for SIGBUS or SIGSEGV exits; done should identify whether PM2 changes the core-size limit and explain or correct the resulting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
devops, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.