Our pipelines started failing with Exception in thread "main" java.lang.OutOfMemoryError: Java heap

Hello. We have faced an issue out of the blue, and it has been happening for every single PR for the last few days. The interesting part is that it occurs for PRs that don’t have intersected files.
The average PR size is 20-25 files with a few changes in each.
No config changes have been done previously.

Please, help figure out the reason. I can share more details via DM

  • ALM used – GitHub
  • CI system used – GitHub
  • Scanner command used when applicable (private details masked)
  sonar:
    needs: [test]
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup
        uses: ./.github/actions/setup

      - name: Download coverage info
        uses: actions/download-artifact@v4
        with:
          name: lcov.info

      - uses: SonarSource/sonarqube-scan-action@v5.1.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

  • Languages of the repository – typescript + jsx
  • Error observed

isAlive was interrupted

11:52:37.083 INFO  Taint analysis for js: Time spent was 00:00:34.080
11:52:37.084 INFO  Report issues: Starting
11:52:37.117 INFO  Report issues: Time spent was 00:00:00.033
11:52:37.117 INFO  Store cache: Starting
11:52:37.117 INFO  Store cache: Time spent was 00:00:00.000
11:52:37.120 INFO  js security sensor: Time spent was 00:01:10.208
11:52:37.124 INFO  js security sensor: Begin: 2025-04-28T11:51:26.911861686Z, End: 2025-04-28T11:52:37.120620269Z, Duration: 00:01:10.208
  Load type hierarchy and UCFGs: Begin: 2025-04-28T11:51:26.912289724Z, End: 2025-04-28T11:51:40.719600761Z, Duration: 00:00:13.807
    Load type hierarchy: Begin: 2025-04-28T11:51:26.912299191Z, End: 2025-04-28T11:51:27.002943610Z, Duration: 00:00:00.090
    Load UCFGs: Begin: 2025-04-28T11:51:27.003056050Z, End: 2025-04-28T11:51:40.719164077Z, Duration: 00:00:13.716
  Check cache: Begin: 2025-04-28T11:51:40.719770718Z, End: 2025-04-28T11:51:40.852692295Z, Duration: 00:00:00.132
    Load cache: Begin: 2025-04-28T11:51:40.719785195Z, End: 2025-04-28T11:51:40.846194784Z, Duration: 00:00:00.126
    Compare cache: Begin: 2025-04-28T11:51:40.847323588Z, End: 2025-04-28T11:51:40.852573424Z, Duration: 00:00:00.005
  Create runtime call graph: Begin: 2025-04-28T11:51:40.852767265Z, End: 2025-04-28T11:51:50.893755421Z, Duration: 00:00:10.040
    Variable Type Analysis #1: Begin: 2025-04-28T11:51:40.853333360Z, End: 2025-04-28T11:51:47.062332775Z, Duration: 00:00:06.208
      Create runtime type propagation graph: Begin: 2025-04-28T11:51:40.857535903Z, End: 2025-04-28T11:51:45.117734078Z, Duration: 00:00:04.260
      Run SCC (Tarjan) on 432362 nodes: Begin: 2025-04-28T11:51:45.118244529Z, End: 2025-04-28T11:51:45.840326693Z, Duration: 00:00:00.722
      Propagate runtime types to strongly connected components: Begin: 2025-04-28T11:51:45.842368429Z, End: 2025-04-28T11:51:47.061453666Z, Duration: 00:00:01.219
    Variable Type Analysis #2: Begin: 2025-04-28T11:51:47.064447677Z, End: 2025-04-28T11:51:50.860201256Z, Duration: 00:00:03.795
      Create runtime type propagation graph: Begin: 2025-04-28T11:51:47.064865656Z, End: 2025-04-28T11:51:49.442717536Z, Duration: 00:00:02.377
      Run SCC (Tarjan) on 432362 nodes: Begin: 2025-04-28T11:51:49.443179888Z, End: 2025-04-28T11:51:49.872914094Z, Duration: 00:00:00.429
      Propagate runtime types to strongly connected components: Begin: 2025-04-28T11:51:49.873173197Z, End: 2025-04-28T11:51:50.859368294Z, Duration: 00:00:00.986
  Load config: Begin: 2025-04-28T11:51:50.893948631Z, End: 2025-04-28T11:51:51.034452450Z, Duration: 00:00:00.140
  Compute entry points: Begin: 2025-04-28T11:51:51.034891889Z, End: 2025-04-28T11:51:51.083158976Z, Duration: 00:00:00.048
  Slice call graph: Begin: 2025-04-28T11:51:51.084262192Z, End: 2025-04-28T11:51:51.084566920Z, Duration: 00:00:00.000
  Live variable analysis: Begin: 2025-04-28T11:51:51.084986121Z, End: 2025-04-28T11:52:02.995790031Z, Duration: 00:00:11.910
  Taint analysis for js: Begin: 2025-04-28T11:52:02.996190137Z, End: 2025-04-28T11:52:37.076206447Z, Duration: 00:00:34.080
  Report issues: Begin: 2025-04-28T11:52:37.082445628Z, End: 2025-04-28T11:52:37.116273678Z, Duration: 00:00:00.033
  Store cache: Begin: 2025-04-28T11:52:37.117109485Z, End: 2025-04-28T11:52:37.117132258Z, Duration: 00:00:00.000
11:52:37.126 INFO  js security sensor peak memory: 2862 MB
11:52:37.126 INFO  Sensor JsSecuritySensor [security] (done) | time=70213ms
11:52:37.126 INFO  Sensor KotlinSecuritySensor [security]
11:52:37.126 INFO  No taint analysis rules have been enabled, will not execute taint analysis.
11:52:37.126 INFO  kotlin security sensor: Time spent was 00:00:00.000
11:52:37.126 INFO  kotlin security sensor: Begin: 2025-04-28T11:52:37.125008147Z, End: 2025-04-28T11:52:37.125241933Z, Duration: 00:00:00.000
11:52:37.126 INFO  kotlin security sensor peak memory: 2862 MB
11:52:37.126 INFO  Sensor KotlinSecuritySensor [security] (done) | time=1ms
11:52:37.132 INFO  ------------- Run sensors on project
11:52:39.444 INFO  Sensor JsArchitectureSensor [architecture]
11:52:39.468 INFO  * Protobuf reading starting | memory total=1986 | free=25 | used=1960 (MB)
11:52:39.468 INFO  * Reading SonarArchitecture IR data from directory "/home/runner/work/mint-ui/mint-ui/.scannerwork/architecture/js"
11:52:39.469 INFO  * Protobuf reading complete | memory total=1986 | free=25 | used=1960 (MB)
11:52:39.473 INFO  * Build file hiGraphs complete | memory total=1986 | free=25 | used=1960 (MB)
11:52:39.476 INFO  * Slicing complete | memory total=1986 | free=25 | used=1960 (MB)
11:52:39.478 INFO  * Cycle detection complete | memory total=1986 | free=24 | used=1961 (MB)
11:52:39.479 INFO  * Build file hiGraphs complete | memory total=1986 | free=24 | used=1961 (MB)
11:52:39.479 INFO  * Slicing complete | memory total=1986 | free=24 | used=1961 (MB)
11:52:39.496 INFO  * Export complete | memory total=1986 | free=23 | used=1962 (MB)
11:52:39.496 INFO  Sensor JsArchitectureSensor [architecture] (done) | time=54ms
11:52:39.496 INFO  Sensor TsArchitectureSensor [architecture]
11:52:39.496 INFO  * Protobuf reading starting | memory total=1986 | free=23 | used=1962 (MB)
11:52:39.496 INFO  * Reading SonarArchitecture IR data from directory "/home/runner/work/mint-ui/mint-ui/.scannerwork/architecture/ts"
11:52:39.691 INFO  * Files successfully loaded: "105" out of "105"
11:52:39.692 INFO  * Protobuf reading complete | memory total=1986 | free=9 | used=1976 (MB)
11:52:39.699 INFO  * Build file hiGraphs complete | memory total=1986 | free=8 | used=1977 (MB)
11:52:39.705 INFO  * Slicing complete | memory total=1986 | free=8 | used=1977 (MB)
11:52:39.714 INFO  * Cycle detection complete | memory total=1986 | free=8 | used=1977 (MB)
11:52:39.730 INFO  * Build file hiGraphs complete | memory total=1986 | free=35 | used=1950 (MB)
11:52:39.737 INFO  * Slicing complete | memory total=1986 | free=34 | used=1951 (MB)
11:52:39.749 INFO  * Export complete | memory total=1986 | free=34 | used=1951 (MB)
11:52:39.749 INFO  Sensor TsArchitectureSensor [architecture] (done) | time=253ms
11:52:39.749 INFO  Sensor Zero Coverage Sensor
11:52:39.850 INFO  Sensor Zero Coverage Sensor (done) | time=100ms
11:52:39.852 INFO  SCM Publisher is disabled
11:53:35.623 INFO  Time spent writing ucfgs 395ms
11:53:35.626 ERROR [stderr] Exception in thread "OkHttp TaskRunner" java.lang.OutOfMemoryError: Java heap space
11:53:35.627 ERROR [stderr] 	at java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
11:53:35.627 ERROR [stderr] 	at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(Unknown Source)
11:53:35.627 ERROR [stderr] 	at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(Unknown Source)
11:53:35.627 ERROR [stderr] 	at okio.InputStreamSource.read(JvmOkio.kt:93)
11:53:35.627 ERROR [stderr] 	at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:128)
11:53:35.627 ERROR [stderr] 	at okio.RealBufferedSource.request(RealBufferedSource.kt:209)
11:53:35.627 ERROR [stderr] 	at okio.RealBufferedSource.require(RealBufferedSource.kt:202)
11:53:35.627 ERROR [stderr] 	at okhttp3.internal.http2.Http2Reader.nextFrame(Http2Reader.kt:89)
11:53:35.627 ERROR [stderr] 	at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:618)
11:53:35.627 ERROR [stderr] 	at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:609)
11:53:35.627 ERROR [stderr] 	at okhttp3.internal.concurrent.TaskQueue$execute$1.runOnce(TaskQueue.kt:98)
11:53:35.627 ERROR [stderr] 	at okhttp3.internal.concurrent.TaskRunner.runTask(TaskRunner.kt:116)
11:53:35.627 ERROR [stderr] 	at okhttp3.internal.concurrent.TaskRunner.access$runTask(TaskRunner.kt:42)
11:53:35.627 ERROR [stderr] 	at okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:65)
11:53:35.627 ERROR [stderr] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
11:53:35.627 ERROR [stderr] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
11:53:35.627 ERROR [stderr] 	at java.base/java.lang.Thread.run(Unknown Source)
11:53:35.631 ERROR isAlive was interrupted
java.lang.InterruptedException: null
	at java.base/java.util.concurrent.CompletableFuture.reportGet(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.get(Unknown Source)
	at java.net.http/jdk.internal.net.http.HttpClientImpl.send(Unknown Source)
	at java.net.http/jdk.internal.net.http.HttpClientFacade.send(Unknown Source)
	at org.sonar.plugins.javascript.bridge.Http$JdkHttp.get(Http.java:71)
	at org.sonar.plugins.javascript.bridge.BridgeServerImpl.isAlive(BridgeServerImpl.java:418)
	at org.sonar.plugins.javascript.bridge.BridgeServerImpl.heartbeat(BridgeServerImpl.java:159)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

11:53:35.805 ERROR [stderr] Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
11:53:35.805 ERROR [stderr] 	at org.sonar.duplications.index.PackedMemoryCloneIndex.createBlock(PackedMemoryCloneIndex.java:115)
11:53:35.805 ERROR [stderr] 	at org.sonar.duplications.index.PackedMemoryCloneIndex.getBlock(PackedMemoryCloneIndex.java:137)
11:53:35.806 ERROR [stderr] 	at org.sonar.duplications.index.PackedMemoryCloneIndex$ResourceIterator.next(PackedMemoryCloneIndex.java:159)
11:53:35.806 ERROR [stderr] 	at org.sonar.duplications.index.PackedMemoryCloneIndex$ResourceIterator.next(PackedMemoryCloneIndex.java:140)
11:53:35.807 ERROR [stderr] 	at org.sonar.scanner.cpd.CpdExecutor.execute(CpdExecutor.java:92)
11:53:35.808 ERROR [stderr] 	at org.sonar.scanner.cpd.CpdExecutor.execute(CpdExecutor.java:83)
11:53:35.808 ERROR [stderr] 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:164)
11:53:35.808 ERROR [stderr] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
11:53:35.808 ERROR [stderr] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
11:53:35.808 ERROR [stderr] 	at org.sonar.scanner.bootstrap.ScannerContainer.doAfterStart(ScannerContainer.java:414)
11:53:35.808 ERROR [stderr] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
11:53:35.808 ERROR [stderr] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
11:53:35.808 ERROR [stderr] 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
11:53:35.808 ERROR [stderr] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
11:53:35.808 ERROR [stderr] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
11:53:35.808 ERROR [stderr] 	at org.sonar.scanner.bootstrap.ScannerMain.runScannerEngine(ScannerMain.java:137)
11:53:35.808 ERROR [stderr] 	at org.sonar.scanner.bootstrap.ScannerMain.run(ScannerMain.java:52)
11:53:35.808 ERROR [stderr] 	at org.sonar.scanner.bootstrap.ScannerMain.main(ScannerMain.java:38)
  • Steps to reproduce – hard to say. it just started
  • Potential workaround – tried to disable sonar.scm.disabled=true but it didn’t help

Hi,

It looks like you need to adjust the heap space.

As a side note, I notice this in your log snippet:

Disabling the SCM detection really isn’t a good idea. It means analysis won’t be able to identify what’s “new”, or to properly assign issues to their authors.

 
HTH,
Ann

I’ve just tried, and no success

  sonar:
    needs: [test]
    runs-on: ubuntu-latest
    timeout-minutes: 60
    env:
      # increase Java heap size to avoid OOM errors
      SONAR_SCANNER_JAVA_OPTS: -Xmx512m
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

Hi,

Please retry with increasingly larger values. Or you could just skip up to something like -Xmx4Gb.

 
HTH,
Ann

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.