Skip to content

Excessive memory usage when processing history leads to Javascript Heap Exhaustion #302

Description

@HenrikDK

Problem, we have a pretty large test suite in python with around 1250+ tests, and when we try to use the github-test-reporter action on main, we get:

Run ctrf-io/github-test-reporter@v1
📜 Preparing CTRF report
⏮️ Processing previous results
  Starting workflow runs processing...
  (node:402) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
  (Use `node --trace-deprecation ...` to show where the warning was created)
  
  <--- Last few GCs --->
  
  [402:0x2ecac000]   100072 ms: Mark-Compact 4089.6 (4126.8) -> 4089.6 (4130.8) MB, pooled: 0 MB, 50.99 / 0.00 ms  (average mu = 0.450, current mu = 0.031) allocation failure; scavenge might not succeed
  [402:0x2ecac000]   100155 ms: Mark-Compact 4090.0 (4131.1) -> 4090.0 (4131.1) MB, pooled: 0 MB, 82.29 / 0.00 ms  (average mu = 0.206, current mu = 0.005) allocation failure; scavenge might not succeed
  
  FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
  ----- Native stack trace -----

Note that this is not a problem on branches and pr's it is exclusively a problem on the main branch.

I have tried limiting the length of the history from the default 10 to 2, but still the problem persists.

Config:

    steps:
      - uses: actions/checkout@v6

      - name: Install pytest
        run: pip3 install pytest pytest-json-ctrf pytest-cov pytest-xdist pytest-mock pyfakefs
        shell: bash

      - name: Test all workflows
        id: run-pytest
        run: | 
          pytest -n auto -m "not serial" --cov=scripts --cov-report=xml --ctrf ctrf-report.json
          rm -f github-summary.env
        shell: bash

      - name: Publish Test Report
        uses: ctrf-io/github-test-reporter@v1
        if: always()
        with:
          report-path: 'ctrf-report.json'
          summary-delta-report: true
          insights-report: true
          flaky-rate-report: true
          upload-artifact: true
          pull-request-report: true
          overwrite-comment: true
          previous-results-max: 2
          comment-tag: PR Test Report
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

When i run the test suite with json output enabled locally the resulting report produced is 60mb large vs 170kb for junit.

Image

I guess this could help explain the data volumes, but it still seems excessive to use 4GB of ram to process 2x60 mb of json?

Relevant logs:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions