"Unable to Create Native Thread" Errors on Debian Systems

Last modified by superadmin on 2026/11/25 21:30

A low systemd task limit on some Debian systems stops Tomcat from creating threads until DefaultTasksMax is raised.

Explanation

When running XWiki on some Debian systems with Tomcat managed by systemd, you may encounter errors similar to the following in catalina.out:

java.lang.OutOfMemoryError: unable to create native thread

Cause

Some Debian installations configure a low default thread limit for services managed by systemd. Since Tomcat runs as a systemd service, this limit can prevent XWiki from creating enough threads under load. You can check the current system-wide limit with:

systemctl show --property DefaultTasksMax

Values around 100 are often too low for XWiki. Depending on the number of concurrent users and subwikis, a higher value may be required. A value around 512 is usually sufficient.

Solution

  1. Open the /etc/systemd/system.conf configuration file.
  2. Increase the DefaultTasksMax value. For example:
    DefaultTasksMax=512
  3. Reload the systemd configuration:
    systemctl daemon-reload
  4. Restart Tomcat:
    systemctl restart tomcat<version>
  5. Check the number of Tomcat threads if the issue persists:
    ps -elfT | grep tomcat<version> | wc -l
  6. Increase DefaultTasksMax further if the number of running threads is close to the configured limit.

Related

Get Connected