IBM Support

java.lang.OutOfMemoryError: unable to create new native thread under DB2 Alphablox

Question & Answer


Question

Resolving "java.lang.OutOfMemoryError: unable to create new native thread" when running DB2 Alphablox

Cause

Allocating too large a heap in a 32-bit JVM or running out of heap memory will lead to this error.

Answer

The message "java.lang.OutOfMemoryError: unable to create new native thread" when running DB2® Alphablox is typically not what it appears to be and typically is found only in 32-bit JVMs. This situation seems to occur both when the JVM is out of memory and also when the JVM is unable to grow the thread pool in order to allocate more threads because doing so may restrict heap growth. Two conditions work together to create this situation: the JVM has been configured with a very high maximum heap size ( the -Xmx JVM startup parameter) and there is a very large number of active threads running under DB2 Alphablox.

This is because threads are allocated in a thread pool that competes with the Java Heap for memory. Under JDK 1.4, a thread takes 256K of memory. If your max. heap were set to 1536M that would leave, at most, 512M for the thread pool or a pool of 2K threads. In actuality, the size of the thread pool would be restricted even further.

To resolve this issue, you need to know:

  • what the max. heap is set to
  • how much heap memory has actually been allocated
  • how many threads are actually running

Begin by getting a thread dump and performing a "stat session" and "stat server" from the DB2 Alphablox telnet console and forwarding these results to DB2 Alphablox Technical Support.

Typically the problem is not actually the number of threads running but simply the max. heap setting. If so, set the Java heap size to a smaller number until the source of the very large number of concurrent threads in the JVM is resolved. If you are running DB2 Alphablox under WebSphere® or Tomcat and do not know how to obtain a thread dump, there are additional DB2 Alphablox technotes on obtaining thread dumps.

    [{"Product":{"code":"SSCPX3","label":"DB2 Alphablox"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Admin and Services","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"},{"code":"PF016","label":"Linux"}],"Version":"8.2;8.3;8.4;9.5","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

    Document Information

    Modified date:
    16 June 2018

    UID

    swg21200491