Unitech / Unitech/pm2

wait_ready not working as intendent

Open
#5,716 0 comments 2 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 I'm using "wait_ready" (in api) and "wait-ready" (in cli) they are not working as intendent.
If the child process not sending "ready" event PM2 just waits "listen_timeout"/"listen-timeout" and then showing app as "online" like nothing happened.
In my understanding PM2 should wait for "ready" event and if there isn't one in specified time it should show that app is "stopped".

How could we reproduce this issue?

pm2 start test.js --listen-timeout 5000 --wait-ready --no-autorestart

Supporting information

I guess problem is in this code: link.
If I understand correctly, if there is no "ready" event sent then timeout is triggered. But timeout function just calls "readyCb" same as "ready" event function.
I guess there should be some "errCb" and not "readyCb".

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 in lib/God.js around line 328 and reproduce the behavior with pm2 start test.js --listen-timeout 5000 --wait-ready --no-autorestart. Trace the timeout and ready-event callbacks; done means a child that does not emit ready is reported as stopped rather than online after the timeout.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.