Bitbucket Server is not available due to "java.lang.OutOfMemoryError: unable to create new native thread"

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Problem

A short time after starting Bitbucket Server, the application stops without any shutdown request.

The following appears in the catalina.out log:

(info) As of Bitbucket Server 5.x, catalina.out will no longer exist. It will be written to atlassian-bitbucket.log instead.

java.lang.OutOfMemoryError: unable to create new native thread

Diagnosis

Environment

  • Linux using systemd as the default init system
    • For example, Ubuntu 15.10+ first introduced systemd as the default

Diagnostic Steps

  • No other processes can be started on the server. For example running a ps command returns the following:
atlbitbucket@bitbucket:~$ ps -efH | grep java
-bash: fork: retry: No child processes

Cause

The UserTasksMax setting in systemd does not allow the creation of a sufficient number of threads.

This setting has a default of 512.

Resolution

  1. Increase the value of the DefaultTasksMax setting by changing the relative line in the /etc/systemd/system.conf to provide a higher number (for example 12288):

    DefaultTasksMax=12288
  2. Restart Bitbucket Server for the change to take effect

Last modified on May 2, 2017

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.