How to fix or debug very slow Ant build

We have a few build configurations that run Ant build steps which seem to hang for about 45 minutes before finally completing. The builds hang very near the end of the step, just after creating an EAR file artifact.

I have tried running the build from the command line using the exact command that TeamCity is using (taken from the build log). This build hangs exactly like it does when run from TeamCity.

I have also tried running the build from the command line but removing the following parameters:
-lib D:/TeamCity/BuildAgent/plugins/antPlugin/ant-runtime.jar;D:/TeamCity/BuildAgent/lib/runtime-util.jar
-listener jetbrains.buildServer.agent.ant.AgentBuildListener

When I run the build without the Ant listener it works properly (does not hang).

I took a thread dump of the command line build that hung. An excerpt from the thread dump is included below.

Any suggestions on how to correct or further debug this problem? We are running TeamCity 7.1.5 and the build is running on Windows Server 2008 R2.

"XML Memory Cleaner" daemon prio=6 tid=0x00000000152c5000 nid=0x7c8 waiting for monitor entry [0x000000001bc5f000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at gw.internal.xml.xsd.typeprovider.XmlSchemaIndex$6.run(XmlSchemaIndex.java:1121)
    at gw.internal.xml.xsd.typeprovider.MemoryCleanerThread.run(MemoryCleanerThread.java:42)

   Locked ownable synchronizers:
    - <0x00000007d41a9990> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)

Please sign in to leave a comment.