I am running sonar under team city for .net/js mainly, and for the most its been working. I have added a new project, which is fairly large compared to the others that have been working and I am now getting this error:
21:16:53 INFO: ------------------------------------------------------------------------
21:16:53 INFO: EXECUTION FAILURE
21:16:53 INFO: ------------------------------------------------------------------------
21:16:53 INFO: Total time: 14:18.280s
21:16:53 ERROR: Error during SonarScanner execution
21:16:53 INFO: Final Memory: 27M/97M
21:16:53 INFO: ------------------------------------------------------------------------
21:16:53 java.lang.OutOfMemoryError: Java heap space
I have set Environment variables for TEAMCITY_SERVER_MEM_OPTS on the build server and both build agents up to 2gb (2048M)
With the final memory only being 27M/97M it seems it should be enough, also watching the diagnostics in Team city, the heap is always under 50%
This is the full error prior to the failure:
Full Exception Error
21:14:17 INFO: Using git CLI to retrieve untracked files
21:14:17 WARN: Analyzing only language associated files, make sure to run the analysis inside a git repository to make use of inclusions specified via "sonar.text.inclusions"
21:15:46 Exception in thread "pool-3-thread-2" java.lang.OutOfMemoryError: Java heap space
21:15:46 at java.base/java.util.TreeMap.addEntry(TreeMap.java:765)
21:15:46 at java.base/java.util.TreeMap.put(TreeMap.java:828)
21:15:46 at java.base/java.util.TreeMap.put(TreeMap.java:534)
21:15:46 at java.base/java.util.TreeSet.add(TreeSet.java:255)
21:15:46 at org.sonar.plugins.common.InputFileContext.buildNormalizedContentAndCalculateOffsets(InputFileContext.java:94)
21:15:46 at org.sonar.plugins.common.InputFileContext.<init>(InputFileContext.java:86)
21:15:46 at org.sonar.plugins.common.Analyzer.lambda$buildInputFileContexts$4(Analyzer.java:114)
21:15:46 at org.sonar.plugins.common.Analyzer$$Lambda$4097/0x000002055eeb9b78.run(Unknown Source)
21:15:46 at org.sonar.plugins.common.thread.ParallelizationManager.lambda$submit$0(ParallelizationManager.java:60)
21:15:46 at org.sonar.plugins.common.thread.ParallelizationManager$$Lambda$4098/0x000002055eeb9d98.run(Unknown Source)
21:15:46 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
21:15:46 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
21:15:46 at java.base/java.lang.Thread.run(Thread.java:842)
21:16:36 ERROR: isAlive was interrupted
21:16:36 java.lang.InterruptedException: null
21:16:36 at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:386)
21:16:36 at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
21:16:36 at java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:553)
21:16:36 at java.net.http/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:123)
21:16:36 at org.sonar.plugins.javascript.bridge.BridgeServerImpl.isAlive(BridgeServerImpl.java:453)
21:16:36 at org.sonar.plugins.javascript.bridge.BridgeServerImpl.heartbeat(BridgeServerImpl.java:142)
21:16:36 at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
21:16:36 at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
21:16:36 at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
21:16:36 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
21:16:36 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
21:16:36 at java.base/java.lang.Thread.run(Thread.java:842)