Unitech / Unitech/pm2

No log output to file from old process when reloading

Open
#5,649 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

What's going wrong?

When reloading a process in cluster mode, the log-output for the old process that is getting shutdown doesnt get written to the log-file.
They are only out-puted to stdout.

How could we reproduce this issue?

log a couple of entries in a shutdown function, which gets executed on process.on('SIGTERM') or process.on('SIGINT').
The logs apear on stdOut (pm2 logs service), but they never enter the logs that is written to the file. Only new log entries from the new process is written.

Supporting information

--- PM2 report ----------------------------------------------------------------
Date                 : Thu Aug 03 2023 18:09:08 GMT+0000 (Coordinated Universal Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.3.0
node version         : 18.16.1
node path            : not found
argv                 : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
uptime               : 24763min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.3.0
node version         : 18.16.1
node path            : /usr/bin/pm2
argv                 : /usr/bin/node,/usr/bin/pm2,report
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Xeon(R) CPU @ 2.80GHz
cpus nb              : 8
freemem              : 24756269056
totalmem             : 33648066560
home                 : /root
===============================================================================

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 a cluster reload with shutdown logging from process.on('SIGTERM') or process.on('SIGINT'), then trace how stdout and the log file are handled for the old process. Done means shutdown entries from the old process appear in the configured log file as well as stdout.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.