JDK-6601634 : When too many threads are created, JVM crashes with "ChunkPool::allocate. Out of swap space?"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 6u5
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2007-09-06
  • Updated: 2012-02-01
  • Resolved: 2008-01-22
Related Reports
Duplicate :  
Description
When allocating threads from the following code:

try {
    for ( ;; ) {
        new Thread(someRunnable).start();
    }
catch ( OutOfMemoryError e ) {
    // ask threads to die
}

...HotSpot may crash with the following output:

linux-amd64:

[2007-09-05T22:43:59.42] Java HotSpot(TM) 64-Bit Server VM warning: Attempt to allocate stack guard pages failed.
...<the message repeats>...
[2007-09-05T22:43:59.47] #
[2007-09-05T22:43:59.47] # An unexpected error has been detected by Java Runtime Environment:
[2007-09-05T22:43:59.47] #
[2007-09-05T22:43:59.47] # java.lang.OutOfMemoryError: requested 32744 bytes for ChunkPool::allocate. Out of swap space?
[2007-09-05T22:43:59.47] #
[2007-09-05T22:43:59.47] #  Internal Error (allocation.cpp:120), pid=4845, tid=1084438880
[2007-09-05T22:43:59.47] #  Error: ChunkPool::allocate
[2007-09-05T22:43:59.47] #
[2007-09-05T22:43:59.47] # Java VM: Java HotSpot(TM) 64-Bit Server VM (1.6.0_05-ea-b02 compiled mode linux-amd64)
...
[2007-09-05T22:43:59.89] Java HotSpot(TM) 64-Bit Server VM warning: Attempt to deallocate stack guard pages failed.
...<the same message again>...

linux-i586:

[2007-09-05T22:48:06.68] #
[2007-09-05T22:48:06.68] # An unexpected error has been detected by Java Runtime Environment:
[2007-09-05T22:48:06.68] #
[2007-09-05T22:48:06.68] # java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate. Out of swap space?
[2007-09-05T22:48:06.68] #
[2007-09-05T22:48:06.68] #  Internal Error (allocation.cpp:120), pid=8721, tid=3986754464
[2007-09-05T22:48:06.68] #  Error: ChunkPool::allocate
[2007-09-05T22:48:06.68] #
[2007-09-05T22:48:06.68] # Java VM: Java HotSpot(TM) Client VM (1.6.0_05-ea-b02 interpreted mode linux-x86)
[2007-09-05T22:48:06.68] # If you would like to submit a bug report, please visit:
[2007-09-05T22:48:06.68] #   http://java.sun.com/webapps/bugreport/crash.jsp
[2007-09-05T22:48:06.68] #

solaris-i586:

[2007-09-05T23:00:49.18] [thread 4093 also had an error]
[2007-09-05T23:00:49.18] [thread 4077 also had an error]
[2007-09-05T23:00:49.18] [thread 4061 also had an error]
[2007-09-05T23:00:49.18] #
[2007-09-05T23:00:49.18] # An unexpected error has been detected by Java Runtime Environment:
[2007-09-05T23:00:49.18] #
[2007-09-05T23:00:49.18] #  SIGBUS[thread 4076 also had an error]
[2007-09-05T23:00:49.18] [thread 4095 also had an error]
[2007-09-05T23:00:49.18] [thread 4079 also had an error]
[2007-09-05T23:00:49.18] [thread 4063 also had an error]
[2007-09-05T23:00:49.18] [thread 4094 also had an error]
[2007-09-05T23:00:49.18] [thread 4078 also had an error]
[2007-09-05T23:00:49.18] [thread 4062 also had an error]
[2007-09-05T23:00:49.18] [thread 4060 also had an error]
[2007-09-05T23:00:49.18] [thread 2 also had an error]
[2007-09-05T23:00:50.21] 

and

[2007-09-05T23:02:15.24] Java HotSpot(TM) Client VM warning: Unexpected Signal 10 occured under user-defined signal handler 0xd23614a8
[2007-09-05T23:02:15.24] [thread 2 also had an error]
[2007-09-05T23:02:15.24] [thread 3954 also had an error]

and

[2007-09-05T23:07:04.94] #
[2007-09-05T23:07:04.94] # An unexpected error has been detected by Java Runtime Environment:
[2007-09-05T23:07:04.94] #
[2007-09-05T23:07:04.94] # java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate. Out of swap space?
[2007-09-05T23:07:04.94] #
[2007-09-05T23:07:04.94] #  Internal Error (allocation.cpp:120), pid=1237, tid=3
[2007-09-05T23:07:04.94] #  Error: ChunkPool::allocate
[2007-09-05T23:07:04.94] #
[2007-09-05T23:07:04.94] # Java VM: Java HotSpot(TM) Tiered VM (1.6.0_05-ea-b02 interpreted mode solaris-x86)
[2007-09-05T23:07:04.94] # An error report file with more information is saved as:
[2007-09-05T23:07:04.94] #
[2007-09-05T23:07:04.94] # If you would like to submit a bug report, please visit:
[2007-09-05T23:07:04.94] #   http://java.sun.com/webapps/bugreport/crash.jsp
[2007-09-05T23:07:04.94] #

Comments
EVALUATION Is this better? [2010-12-16T22:17:28.21] Creating threads... [2010-12-16T22:17:45.03] # There is insufficient memory for the Java Runtime Env ironment to continue. [2010-12-16T22:17:45.03] # Attempted to allocate 32744 bytes for ChunkPool::allocate [2010-12-16T22:17:45.03] # An error report file with more information is saved a s: [2010-12-16T22:17:45.03] # /net/resexhausted001/hs_err_pid1422.log [2010-12-16T22:17:45.03] [thread 2567 also had an error] [2010-12-16T22:17:45.03] [thread 2 also had an error] with hs_err_pid*.log file with: # There is insufficient memory for the Java Runtime Environment to continue. # Attempted to allocate 32744 bytes for ChunkPool::allocate. # Possible solutions: # reduce memory load on the system # increase physical memory or swap space # check if swap backing store is full # decrease Java heap size (-Xmx/-Xms) # decrease number of Java threads # decrease Java thread stack sizes (-Xss) # This output file may be truncated or incomplete. # # JRE version: 7.0-b118 # Java VM: Java HotSpot(TM) Server VM (20.0-b04-6892275_1214_1557-fastdebug mixe d mode solaris-sparc ) ...
16-12-2010

EVALUATION Yes, because the threads use up C Heap and run out. The message might be a bit unclear and worrysome because it produces an hs_err log file, but it does detect this. This is a duplicate of 6302804, where sometimes the message is less clear.
22-01-2008