ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murray, Mike" <>
Subject RE: OutOfMemoryError: unable to create new native thread
Date Fri, 30 Jan 2009 05:32:15 GMT
All the "hung" threads display the same "blocked" scenario as


Name: Thread-1199

State: BLOCKED on owned by:

Total blocked: 1  Total waited: 0


Stack trace:



Name: Thread-11


Total blocked: 0  Total waited: 0


Stack trace: Method)

   - locked


This is 1.7.1 code, but it appears that cvs might
contained a fixed version.

76     /**
77      * Copies data from the input stream to the output stream.
78      *
79      * Terminates as soon as the input stream is closed or an error
80      */
81     public void run() {
82         synchronized (this) {
83             started = true;
84         }
85         finished = false;
86         finish = false;
88         final byte[] buf = new byte[bufferSize];
90         int length;
91         try {
92             while ((length = > 0 && !finish) {

93                 os.write(buf, 0, length);
94                 if (autoflush) {
95                     os.flush();
96                 }
97             }


From: Murray, Mike 
Sent: Thursday, January 29, 2009 9:17 PM
To: 'Ant Users List'
Subject: OutOfMemoryError: unable to create new native thread


Since I'm allocating the JVM 1G for Heap and 370M for PermGen, the OS
runs out of room for all the threads. 


I don't know why the threads continually climb while the builds runs.
By the time it dies, the jconsole shows 888 lives threads, 890 peak and
4,013 total.  It seems some of the parallel blocks are not releasing the
thread when they are done.  The jconsole graphs shows continuous growth
in live threads from beginning to end.


The top-level script calls 282 module builds using the <ant> task.  The
282 modules are grouped in 37 parallel blocks.  When it dies it is on
the 222nd module, which is in about the 30th of the 37 parallel blocks.
There are other parallel blocks within each module build.


I just under covered this problem, after removing a long present problem
that was causing it to run out of Heap memory.


I would appreciate any insight anyone might have.


Thanks, Mike


Windows XP

Apache Ant version 1.7.1 compiled on June 27 2008

java version "1.6.0_10"

Java(TM) SE Runtime Environment (build 1.6.0_10-b33)

Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode)


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message