Software Build, CI and Test Automation
27 Jul
I received a call from one of our development build meisters … there is a build issue that needs to be resolved for a complex application – this application was building successfully for years without any problems and suddenly it stopped working today. I looked at the error snippet that he had emailed me from the build log…
[cc lang="java" tab_size="2" lines="10"]
compile: [javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] java.lang.OutOfMemoryError
[/cc]
The first thought that went through my head was “I know how to resolve this – I have seen it before”! I knew that the build tool uses Ant under the cover for Java compiles. All I have to do is increase the memory using ANT_OPTS.
This problem was happening on an Unix machine – this was one of our controlled build machines for our enterprise java builds. Before I changed the environment variable on the build machine, I went through the usual drill…
I asked if anything had changed significantly with the application today – I heard that there was no change other than a few java files were added. I asked him if his other applications were building – he said that everything else has been building successfully except this one application. I asked him if we are able to reproduce this “out of memory” problem – he tried the build for the same application and the compile failed at the same step.
Just to be sure, I requested the on call unix administrator to see if there was any memory problems reported at the system level for that machine. The machine didn’t report any errors of being out of memory or high swap at all that day.
It was time to set the ANT_OPTS environment variable! I added “export ANT_OPTS=-Xmx512m” to the .profile of the system user that is used for all controlled builds on that machine. The development build meister tried the build again – it passed the compile step where it had failed consistently today! The build was successful once again for this complex application. Problem solved!