The JVM cannot create a thread (OutOfMemoryError: unable to create native thread)
- Platforms
- Paper · Purpur · single server
- Verified
- Verified
- Confidence
- Confidence 85%
What it looks like in the log
Any one of these lines is enough. The agent matches them locally, on your server.
logs/latest.log
[WARN] native thread
Symptoms
- Plugins, networking or tasks stop working; the server may hang or crash
- In the log: “java.lang.OutOfMemoryError: unable to create native thread”
Cause
The OS refused to create a new thread: the process/thread limit (container pids limit, ulimit -u) or native memory is exhausted. Most often a plugin is spawning threads (a thread leak).
Possible causes
- A plugin creates threads/pools and never shuts them down (a thread leak)
- A low pids limit in the container (Docker/Pterodactyl) or ulimit -u
- Native memory exhausted (the container is at its RAM limit)
How to fixLow risk
- Restart the server to get it working again.
- Before the crash (or at intervals after the restart), capture the thread list:
/spark profiler --thread *orjstack <pid>; look for hundreds of threads with the same name — the pool name usually reveals the plugin. - Check the limits:
cat /sys/fs/cgroup/pids.maxin the container,ulimit -ufor the server user; if the value is too low, ask your host to raise it. - Update or replace the plugin that creates the threads.
Translated from the Russian original; log lines are quoted verbatim.