Unitech / Unitech/pm2

Clustering not working with Bun

Open
#5,893 53 comments 3 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?

Clustering do not work with Bun. 😕

How could we reproduce this issue?

The following spawns forked instead of cluster:

pm2 start --interpreter /opt/homebrew/bin/bun --instances 2 ./build/index.js
Screenshot 2024-09-18 at 7 50 31 PM

Supporting information

--- PM2 report ----------------------------------------------------------------
Date                 : Wed Sep 18 2024 14:47:12 GMT+0530 (India Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.4.2
node version         : 20.17.0
node path            : /Users/harry/.bun/bin/pm2
argv                 : /opt/homebrew/Cellar/node@20/20.17.0/bin/node,/Users/harry/.bun/install/global/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : harry
uid                  : 501
gid                  : 20
uptime               : 7min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.4.2
node version         : 20.17.0
node path            : /Users/harry/.bun/bin/pm2
argv                 : /opt/homebrew/Cellar/node@20/20.17.0/bin/node,/Users/harry/.bun/bin/pm2,report
argv0                : node
user                 : harry
uid                  : 501
gid                  : 20
===============================================================================
--- System info --------------------------------------------
arch                 : arm64
platform             : darwin
type                 : Darwin
cpus                 : Apple M2
cpus nb              : 8
freemem              : 313901056
totalmem             : 17179869184
home                 : /Users/harry

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 by reproducing the reported command with Bun and two instances, then inspect PM2's clustering and interpreter handling as indicated by the forked-versus-clustered behavior. Done means the same invocation starts clustered processes under Bun, with a regression test or equivalent verification covering the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, javascript
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.