Sonar-scanner In-memory buffer limit exceeded

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube: 7.5.0 Developer Edition
    sonar-scanner: (on Mac Mojave)
  • what are you trying to achieve
    Run a code coverage analysis of an iOS app
  • what have you tried so far to achieve this
    When running sonar-scanner I receive the following error:
09:24:32.012 ERROR: ERROR: Exception caught while accessing pack file /private/var/jenkins/workspace/<project>/.git/objects/pack/pack-3929fde6de9a3402293ee9f8c69ad126e83cd46c.pack, the pack file might be corrupt, {1}. Caught {2} consecutive errors while trying to read this pack. In-memory buffer limit exceeded
	at org.eclipse.jgit.revwalk.RevWalk.getCachedBytes(
	at org.eclipse.jgit.revwalk.RevCommit.parseHeaders(
	at org.eclipse.jgit.revwalk.RevWalk.parseHeaders(
	at org.eclipse.jgit.blame.BlameGenerator.processOne(
	at org.eclipse.jgit.blame.BlameResult.computeAll(
	at org.eclipse.jgit.blame.BlameGenerator.computeBlameResult(
	at org.sonarsource.scm.git.JGitBlameCommand.blame(
	at org.sonarsource.scm.git.JGitBlameCommand.lambda$null$0(
	at java.base/$ForEachOp$OfRef.accept(
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(
	at java.base/
	at java.base/$ForEachTask.compute(
	at java.base/java.util.concurrent.CountedCompleter.exec(
	at java.base/java.util.concurrent.ForkJoinTask.doExec(
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(
	at java.base/java.util.concurrent.ForkJoinPool.scan(
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(
	at java.base/

I have tried setting SONAR_SCANNER_OPTS to various values, from -Xmx512m all the way to -Xmx4096m with the same result.

Is there another limit or timeout at play during a sonar-scanner run I can look at to resolve the error?

I resolved the issue by installing more memory on the Mac.

The error is specific to the library used to handle git (JGit), it doesn’t necessarily mean you ran out of memory. You resolved the problem just by installing more memory in your computer?

Yes, adding memory to the Mac resolved this specific issue. We are running our CI/CD pipeline on MacStadium’s “cloud” platform, a Mac Pro with VMWare ESX. The Mac builders are running as VMs with 4 GB RAM. This error went away when we increased the RAM to 6 GB.