Tuesday, July 19, 2011

OutOfMemoryError running Ant from Hudson

java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:640)
at java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(ThreadPoolExecutor.java:703)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:652)


Increasing Hudson heap will do no good, since Hudson runs Ant tasks in a separate JVM (I think!).

Rather define

export ANT_OPTS="-Xmx1024m -Xms1024m"

and ant_exec_debug=true



In any case - after a lot of tears and pain - we discovered by running "free" that the Unix box memory was simply totally occupied by running processes.... :o(

Java doesn't differentiate between an OutOfMemory caused by hitting the Heap limit imposed by the -Xms and -Xmx flags, and one caused by hitting physical limits of the host.

No comments: