fix(ci): cap back-end jest workers to prevent OOM on CI runner#828
Merged
Conversation
Kevin Loftus (kevin-loftus-dept)
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title*
fix(ci): cap back-end jest workers to prevent OOM on CI runner
Type of Change*
Description
The
Build & Deploy Back-Endjob incicd-release-quality(and the sandbox/UAT release pipelines) started failing deterministically ondevelopmentafter PR #823 (fix(EGV-206): upgrade aws-cdk-lib), which bumpedaws-cdk-libfrom^2.176.0to^2.260.0.Root cause is an out-of-memory kill, not a test failure:
packages/back-end/test/infra/**suites synthesize full CDK stacks (e.g.easy-genomics-nested-stack,auth-nested-stack), each consuming ~1.4 GB of heap.cpuCount - 1→ 3 workers on the 4-vCPUubuntu-latestrunner), each worker inheritingNODE_OPTIONS=--max-old-space-size=8192and running with v8 coverage enabled.aws-cdk-libraised each synth's footprint just enough that the aggregate RSS across the parallel workers crossed the 16 GB runner limit. The OS OOM-killer thenSIGKILLed the process group — which is why the run exits1with no Jest summary, output cut off mid-flush, and no V8 "Reached heap limit" message.This is why the failure was deterministic and re-running the pipeline did not help.
The fix reduces peak memory without touching application code, all via the projen source of truth (
.projenrc.ts) which regenerates the back-end config:maxWorkers: '50%'— caps concurrent Jest workers so the heavy infra synth suites don't all run at once (2 workers on the CI runner instead of 3).--workerIdleMemoryLimit=2GB— recycles a worker once it exceeds 2 GB, freeing accumulated coverage/synth memory between suites instead of letting it grow for the worker's lifetime.Testing*
packages/back-end/package.json→jest.maxWorkers: "50%"packages/back-end/.projen/tasks.json→jest --workerIdleMemoryLimit=2GB --passWithNoTests --updateSnapshotImpact
Additional Information
.projenrc.ts(source), plus the two projen-generated filespackages/back-end/package.jsonandpackages/back-end/.projen/tasks.json. Regenerate withpnpm exec projenif editing.projenrc.ts.--workerIdleMemoryLimitis passed viaextraCliOptionsbecause it is not exposed in projen'sJestConfigOptionstype;maxWorkersis set directly injestConfig.Checklist*