java.io.IOException: error=12, Cannot allocate memory
症状
When trying to add a Git repository to Fisheye the following memory related error is encountered:
com.atlassian.utils.process.ProcessException: java.io.IOException: Cannot run program "git" (in directory "/home/ubuntu/crucible/var/cache/XXXXX/clone"): java.io.IOException: error=12, Cannot allocate memory
com.cenqua.fisheye.rep.RepositoryClientException: com.atlassian.fisheye.dvcs.handler.DvcsProcessException: Error while communicating with VCS:
at com.atlassian.fisheye.dvcs.DvcsScanner.processRevisions(DvcsScanner.java:298)
at com.atlassian.fisheye.git.GitScanner.processRevisions(GitScanner.java:256)
at com.cenqua.fisheye.rep.BaseRepositoryScanner.slurpRepository(BaseRepositoryScanner.java:258)
at com.cenqua.fisheye.rep.BaseRepositoryScanner.doSlurpTransaction(BaseRepositoryScanner.java:225)
at com.cenqua.fisheye.rep.BaseRepositoryScanner.ping(BaseRepositoryScanner.java:184)
at com.cenqua.fisheye.rep.BaseRepositoryEngine.doSlurp(BaseRepositoryEngine.java:92)
at com.cenqua.fisheye.rep.RepositoryEngine.slurp(RepositoryEngine.java:381)
at com.cenqua.fisheye.rep.ping.OneOffPingRequest.doRequest(OneOffPingRequest.java:28)
at com.cenqua.fisheye.rep.ping.PingRequest.process(PingRequest.java:67)
at com.cenqua.fisheye.rep.RepositoryHandle.processPingRequests(RepositoryHandle.java:138)
at com.cenqua.fisheye.rep.RepositoryHandle.queuePingRequest(RepositoryHandle.java:128)
at com.cenqua.fisheye.rep.ping.PingRequest.run(PingRequest.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Caused by: com.atlassian.fisheye.dvcs.handler.DvcsProcessException: Error while communicating with VCS:
at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:214)
at com.atlassian.fisheye.git.GitScanner.processChanges(GitScanner.java:1004)
at com.atlassian.fisheye.git.GitScanner.slurpCommits(GitScanner.java:977)
at com.atlassian.fisheye.dvcs.DvcsScanner.processBranch(DvcsScanner.java:414)
at com.atlassian.fisheye.dvcs.DvcsScanner.processRevisions(DvcsScanner.java:236)
... 14 more
Caused by: com.atlassian.utils.process.ProcessException: While executing: "git whatchanged --always --reverse --date-order -m --no-abbrev --no-renames 22a291b2f78c0e1d69cb1b23b53896d2a4cb174e --pretty=format:C:%H%nP:%P%nA:%aN%nE:%aE%nR:%cN%nF:%cE%nD:%at%nS:%s%nB:%b%n@@fe_body_end@@ "
at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:262)
at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:254)
at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:212)
... 18 more
Caused by: com.atlassian.utils.process.ProcessException: com.atlassian.fisheye.dvcs.handler.DvcsProcessRuntimeException: com.atlassian.fisheye.dvcs.handler.DvcsProcessException: Error while communicating with VCS:
at com.atlassian.utils.process.ExternalProcessImpl$4.doTask(ExternalProcessImpl.java:273)
at com.atlassian.utils.process.LatchedRunnable.run(LatchedRunnable.java:25)
... 3 more
Caused by: com.atlassian.fisheye.dvcs.handler.DvcsProcessRuntimeException: com.atlassian.fisheye.dvcs.handler.DvcsProcessException: Error while communicating with VCS:
at com.atlassian.fisheye.git.GitScanner$9.processCommit(GitScanner.java:1083)
at com.atlassian.fisheye.git.client.GitChangeParser.handleCommit(GitChangeParser.java:217)
at com.atlassian.fisheye.git.client.GitChangeParser.scanPaths(GitChangeParser.java:157)
at com.atlassian.fisheye.git.client.GitChangeParser.processLine(GitChangeParser.java:61)
at com.atlassian.utils.process.LineOutputHandler.process(LineOutputHandler.java:49)
at com.atlassian.utils.process.LineOutputHandler.process(LineOutputHandler.java:36)
at com.atlassian.utils.process.PluggableProcessHandler.processOutput(PluggableProcessHandler.java:34)
at com.atlassian.utils.process.ExternalProcessImpl$4.doTask(ExternalProcessImpl.java:270)
... 4 more
Caused by: com.atlassian.fisheye.dvcs.handler.DvcsProcessException: Error while communicating with VCS:
at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:214)
at com.atlassian.fisheye.git.GitScanner.getDiffInfo(GitScanner.java:1020)
at com.atlassian.fisheye.git.GitScanner.processGitCommit(GitScanner.java:572)
at com.atlassian.fisheye.git.GitScanner$9.processCommit(GitScanner.java:1081)
... 11 more
Caused by: com.atlassian.utils.process.ProcessException: While executing: "git whatchanged --always --no-renames --no-abbrev --full-index -U0 --pretty=format: 0180dbf3913c63b503973c7c3841c43f2b37b07a "
at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:262)
at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:254)
at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:212)
... 14 more
Caused by: com.atlassian.utils.process.ProcessException: java.io.IOException: Cannot run program "git" (in directory "/home/ubuntu/crucible/var/cache/XXXXX/clone"): java.io.IOException: error=12, Cannot allocate memory
at com.atlassian.utils.process.ExternalProcessImpl.start(ExternalProcessImpl.java:241)
at com.atlassian.utils.process.ExternalProcessImpl.execute(ExternalProcessImpl.java:350)
at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:259)
... 16 more
Caused by: java.io.IOException: Cannot run program "git" (in directory "/home/ubuntu/crucible/var/cache/XXXXX/clone"): java.io.IOException: error=12, Cannot allocate memory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
at java.lang.Runtime.exec(Runtime.java:610)
at com.atlassian.utils.process.ExternalProcessImpl.createProcess(ExternalProcessImpl.java:225)
at com.atlassian.utils.process.ExternalProcessImpl.start(ExternalProcessImpl.java:238)
... 18 more
Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory
at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
at java.lang.ProcessImpl.start(ProcessImpl.java:81)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
... 21 more
2012-05-25 07:29:52,941 DEBUG [InitialPinger1 XXXXX] fisheye.app RepositoryStatus-setEngineError - Engine Error Set [XXXXX]: Repository index failed due to error
com.cenqua.fisheye.rep.RepositoryClientException: com.atlassian.fisheye.dvcs.handler.DvcsProcessException: Error while communicating with VCS:
com.atlassian.fisheye.dvcs.handler.DvcsProcessException: Error while communicating with VCS:
com.atlassian.utils.process.ProcessException: While executing: "git whatchanged --always --reverse --date-order -m --no-abbrev --no-renames 22a291b2f78c0e1d69cb1b23b53896d2a4cb174e --pretty=format:C:%H%nP:%P%nA:%aN%nE:%aE%nR:%cN%nF:%cE%nD:%at%nS:%s%nB:%b%n@@fe_body_end@@ "
com.atlassian.utils.process.ProcessException: com.atlassian.fisheye.dvcs.handler.DvcsProcessRuntimeException: com.atlassian.fisheye.dvcs.handler.DvcsProcessException: Error while communicating with VCS:
com.atlassian.fisheye.dvcs.handler.DvcsProcessRuntimeException: com.atlassian.fisheye.dvcs.handler.DvcsProcessException: Error while communicating with VCS:
com.atlassian.fisheye.dvcs.handler.DvcsProcessException: Error while communicating with VCS:
com.atlassian.utils.process.ProcessException: While executing: "git whatchanged --always --no-renames --no-abbrev --full-index -U0 --pretty=format: 0180dbf3913c63b503973c7c3841c43f2b37b07a "
com.atlassian.utils.process.ProcessException: java.io.IOException: Cannot run program "git" (in directory "/home/ubuntu/crucible/var/cache/XXXXX/clone"): java.io.IOException: error=12, Cannot allocate memory
java.io.IOException: Cannot run program "git" (in directory "/home/ubuntu/crucible/var/cache/XXXXX/clone"): java.io.IOException: error=12, Cannot allocate memory
java.io.IOException: java.io.IOException: error=12, Cannot allocate memory
原因
When Fisheye starts git, it uses the 'fork' system call, which will temporarily allocate the same amount of memory used by the Fisheye JVM to the git process. The git process will never actually use this memory, but the system call will fail if the OS can't provide it.
ソリューション
You can try allowing Linux to 'overcommit' memory via the command 'echo 1 > /proc/sys/vm/overcommit_memory', but it may be better to increase the amount of swap space allocated. In general you should reduce your heap size to whatever Fisheye actually needs -- increasing it will only make this problem worse.