Skip to content
Tickwise
CriticalMemorySIG-MEM-003

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

  1. Restart the server to get it working again.
  2. Before the crash (or at intervals after the restart), capture the thread list: /spark profiler --thread * or jstack <pid>; look for hundreds of threads with the same name — the pool name usually reveals the plugin.
  3. Check the limits: cat /sys/fs/cgroup/pids.max in the container, ulimit -u for the server user; if the value is too low, ask your host to raise it.
  4. Update or replace the plugin that creates the threads.

Translated from the Russian original; log lines are quoted verbatim.

Sources