Can’t run a build in TeamCity

continuous integrationteamcity

I have problems with some configuration of my TeamCity project.
I'm trying to build an application in order to run its Unit Tests, but i can't.

It seems that my project have problems to get the source from git, which is a private repo:

Build 'Myproject :: Build Myproject' #15 
Started 'Fri Jun 29 12:41:28 EDT 2012' on 'Default Agent' by 'you'
Finished 'Fri Jun 29 12:41:47 EDT 2012' with status 'ERROR Unable to collect changes'
TeamCity URL http://ieditedthispart.compute-1.amazonaws.com:8111/viewLog.html?buildId=16&buildTypeId=bt2 
TeamCity server version is 7.0.3 (build 21424)

[12:41:29]: bt2
[12:41:29]: Checking for changes
[12:41:47]: [PREPARATION_FAILURE_TYPE]
[12:41:47]: Failed to start build
[12:41:47]: Failed to collect changes, error: 'git fetch' command failed.
stderr: java.lang.OutOfMemoryError: Java heap space
    at org.eclipse.jgit.storage.pack.BinaryDelta.apply(BinaryDelta.java:163)
    at org.eclipse.jgit.storage.pack.BinaryDelta.apply(BinaryDelta.java:118)
    at org.eclipse.jgit.transport.PackParser.resolveDeltas(PackParser.java:561)
    at org.eclipse.jgit.transport.PackParser.resolveDeltas(PackParser.java:544)
    at org.eclipse.jgit.transport.PackParser.resolveDeltas(PackParser.java:507)
    at org.eclipse.jgit.transport.PackParser.parse(PackParser.java:462)
    at org.eclipse.jgit.storage.file.ObjectDirectoryPackParser.parse(ObjectDirectoryPackParser.java:178)
    at org.eclipse.jgit.transport.PackParser.parse(PackParser.java:410)
    at org.eclipse.jgit.transport.BasePackFetchConnection.receivePack(BasePackFetchConnection.java:649)
    at org.eclipse.jgit.transport.BasePackFetchConnection.doFetch(BasePackFetchConnection.java:280)
    at org.eclipse.jgit.transport.TransportHttp$SmartHttpFetchConnection.doFetch(TransportHttp.java:64...
[12:41:47]: Build finished

As you can see, is alerting about Java Out of Memory, but it doesn't make sense because its running with at least 1300MB of heap size.

Best Answer

It seems that was a problem with the JAVA heap size or memory options at startup TeamCity.

I had to set the following environment variables:

export TEAMCITY_SERVER_MEM_OPTS="-Xmx1300m -XX:MaxPermSize=270m"
export TEAMCITY_SERVER_OPTS="-Dteamcity.git.fetch.separate.process=false"