GlassFish2xAsAdmin uses Ant's Execute task and an ExecuteWatchdog. The ExecuteWatchdog will terminate the executed process after a timeout. Unfortunately, GlassFish2xAsAdmin uses a hardcoded, non-configurable timeout of 30 seconds to execute the "asadmin" script.
We have very slow build machines and it takes a little more than 30 seconds for the deployment. Hence, the deployment randomly/often fails due to the timeout.
It would be nice to have a way to configure the timeout. Another option would be to increase the default timeout to a higher value, such as 5 minutes.
A Workaround would have been to use the "async" option, but the value is hardcoded to "false" in GlassFish2xInstalledLocalDeployer.