ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murray, Mike" <...@ptc.com>
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
thread-1199.  

 

Name: Thread-1199

State: BLOCKED on java.io.BufferedInputStream@1b5973f owned by:
Thread-11

Total blocked: 1  Total waited: 0

 

Stack trace: 

java.io.BufferedInputStream.read(BufferedInputStream.java:308)

java.io.FilterInputStream.read(FilterInputStream.java:116)

java.io.FilterInputStream.read(FilterInputStream.java:90)

org.apache.tools.ant.taskdefs.StreamPumper.run(StreamPumper.java:92)

java.lang.Thread.run(Thread.java:619)

 

 

Name: Thread-11

State: RUNNABLE

Total blocked: 0  Total waited: 0

 

Stack trace: 

java.io.FileInputStream.readBytes(Native Method)

java.io.FileInputStream.read(FileInputStream.java:199)

java.io.BufferedInputStream.fill(BufferedInputStream.java:218)

java.io.BufferedInputStream.read1(BufferedInputStream.java:258)

java.io.BufferedInputStream.read(BufferedInputStream.java:317)

   - locked java.io.BufferedInputStream@1b5973f

java.io.FilterInputStream.read(FilterInputStream.java:116)

java.io.FilterInputStream.read(FilterInputStream.java:90)

org.apache.tools.ant.taskdefs.StreamPumper.run(StreamPumper.java:92)

java.lang.Thread.run(Thread.java:619)

 

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

http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/an
t/taskdefs/StreamPumper.java?r1=577308&r2=711860

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
occurs.
80      */
81     public void run() {
82         synchronized (this) {
83             started = true;
84         }
85         finished = false;
86         finish = false;
87 
88         final byte[] buf = new byte[bufferSize];
89 
90         int length;
91         try {
92             while ((length = is.read(buf)) > 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)

 


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