Error pthread_create: Resource temporarily unavailable when having too many apps running
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?
I am running a Linux vServer which as 4 CPU vCore´s. I just added a new app running pm2 (now there are 5) and now I can´t stop or start any process. It just hangs here:
[PM2] Applying action stopProcessId on app [affiliate-backend](ids: [ 1 ])
In the logs I saw this error message:
pthread_create: Resource temporarily unavailable
Can I only run 4 apps when I have only 4 CPU cores? Is this a known problem?
How could we reproduce this issue?
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Sun Jan 03 2021 18:13:33 GMT+0100 (GMT+01:00)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 4.2.3
node version : 12.18.3
node path : not found
argv : /usr/local/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : nodejs
uid : 1000
gid : 1008
uptime : 1min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 4.5.1
node version : 12.18.3
node path : /usr/local/bin/pm2
argv : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0 : node
user : nodejs
uid : 1000
gid : 1008
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Xeon(R) CPU E5-2630 0 @ 2.30GHz
cpus nb : 4
freemem : 7021244416
totalmem : 8589934592
home : /home/nodejs
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬─────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼─────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 1 │ affiliate-backend │ default │ 0.0.1 │ fork │ 1514 │ 61s │ 0 │ online │ 0% │ 105.5mb │ root │ disabled │
│ 4 │ estimationpoker.de │ default │ 0.0.0 │ fork │ 1534 │ 61s │ 0 │ online │ 0.7% │ 122.8mb │ root │ disabled │
│ 2 │ festival-packlist.de │ default │ N/A │ fork │ 1520 │ 61s │ 0 │ online │ 0% │ 54.8mb │ nodejs │ disabled │
│ 0 │ myhome.statsit │ default │ N/A │ fork │ 1561 │ 60s │ 1 │ online │ 0% │ 11.1mb │ root │ disabled │
│ 3 │ word-detective.de │ default │ 0.0.1 │ fork │ 1527 │ 61s │ 0 │ online │ 0% │ 105.5mb │ nodejs │ disabled │
└─────┴─────────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/home/nodejs/.pm2/pm2.log last 20 lines:
PM2 | 2021-01-03T18:12:31: PM2 log: BUS socket file : /home/nodejs/.pm2/pub.sock
PM2 | 2021-01-03T18:12:31: PM2 log: Application log path : /home/nodejs/.pm2/logs
PM2 | 2021-01-03T18:12:31: PM2 log: Worker Interval : 30000
PM2 | 2021-01-03T18:12:31: PM2 log: Process dump file : /home/nodejs/.pm2/dump.pm2
PM2 | 2021-01-03T18:12:31: PM2 log: Concurrent actions : 2
PM2 | 2021-01-03T18:12:32: PM2 log: SIGTERM timeout : 1600
PM2 | 2021-01-03T18:12:32: PM2 log: ===============================================================================
PM2 | 2021-01-03T18:12:32: PM2 log: App [myhome.statsit:0] starting in -fork mode-
PM2 | 2021-01-03T18:12:32: PM2 log: App [myhome.statsit:0] online
PM2 | 2021-01-03T18:12:32: PM2 log: App [affiliate-backend:1] starting in -fork mode-
PM2 | 2021-01-03T18:12:32: PM2 log: App [festival-packlist.de:2] starting in -fork mode-
PM2 | 2021-01-03T18:12:32: PM2 log: App [affiliate-backend:1] online
PM2 | 2021-01-03T18:12:32: PM2 log: App [festival-packlist.de:2] online
PM2 | 2021-01-03T18:12:32: PM2 log: App [word-detective.de:3] starting in -fork mode-
PM2 | 2021-01-03T18:12:32: PM2 log: App [estimationpoker.de:4] starting in -fork mode-
PM2 | 2021-01-03T18:12:32: PM2 log: App [word-detective.de:3] online
PM2 | 2021-01-03T18:12:32: PM2 log: App [estimationpoker.de:4] online
PM2 | 2021-01-03T18:12:33: PM2 log: App [myhome.statsit:0] exited with code [0] via signal [SIGABRT]
PM2 | 2021-01-03T18:12:33: PM2 log: App [myhome.statsit:0] starting in -fork mode-
PM2 | 2021-01-03T18:12:33: PM2 log: App [myhome.statsit:0] online
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file, test, or reproduction steps are named. Start by reproducing the reported Linux setup using the attached PM2 report, then trace PM2's process-start and stop handling around pthread_create failures and system resource limits. Done means the cause is confirmed and the issue has a documented or tested resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, linux, nodejs
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100