Skip to content

Commit 699b011

Browse files
ci(bun): put the worker idle-memory limit above what the suite uses
`runtimes (bun)` segfaults at a different wild address each run, on this branch and on main alike. Reproduced locally with Bun 1.3.14, the CI patches and the CI command, and it is the idle-memory restart: with the limit below what the suite uses, workers restart constantly and Bun crashes tearing one down. limit vs the suite's heaps result 16MB below segfault, spawned(61) terminated(57) 64MB below segfault, spawned(20) terminated(16) 512MB above 103 suites, 28993 tests, green 2048MB above 103 suites, 28993 tests, green The last green CI run had no limit at all and finished all 159 suites with worker heaps reaching 1337 MB. Restoring the limit set it to the 512 MB the other runtimes use — under half of that — so it fires on workers doing ordinary work, and the run dies about a third of the way in. Raise it to 2048 MB: above what the suite needs, still a bound on a worker that runs away. Node and Deno keep 512 MB, where a spurious restart only costs time. Ending a worker rather than terminating it, as the patch already does, buys Bun a restart it would not otherwise survive — a small run took five and passed — but not a run full of them. Both teardown paths crash in bulk, so the limit is the lever, and the patch is left as it is.
1 parent 1b8718b commit 699b011

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,9 @@ jobs:
339339
# jest-worker patch also has a Bun worker end itself rather than be
340340
# terminated from the parent, which segfaults Bun on an idle-memory restart
341341
# — and exit once it has, since ending only drops its message listener and
342-
# a worker still holding a handle would never be replaced.
342+
# a worker still holding a handle would never be replaced. That buys Bun a
343+
# restart it would not otherwise survive, but not a run full of them, so the
344+
# limit has to sit above what the suite actually uses (see test:base:bun).
343345
- if: matrix.runtime == 'bun'
344346
run: |
345347
git apply test/patches/jest-worker+30.4.1.patch

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"test:deno": "yarn test:base:deno --reporters default --reporters \"<rootDir>/test/runtimeCrashReporter.js\" --testMatch \"<rootDir>/test/*.{basictest,longtest,test,unittest}.js\" --testPathIgnorePatterns \"/node_modules/\" \"(ProfilingPlugin[.]unittest|SyntaxBrowserEquivalence|WebpackDevServer)\"",
7171
"test:base:deno": "deno --allow-read --allow-env --allow-sys --allow-ffi --allow-write --allow-run --allow-net --import-map=test/deno-import-map.json --v8-flags='--max-old-space-size=4096' ./node_modules/jest-cli/bin/jest.js --workerIdleMemoryLimit=512MB --logHeapUsage",
7272
"test:bun": "yarn test:base:bun --reporters default --reporters \"<rootDir>/test/runtimeCrashReporter.js\" --testMatch \"<rootDir>/test/*.{basictest,longtest,test,unittest}.js\" --testPathIgnorePatterns \"/node_modules/\" \"(ProfilingPlugin[.]unittest|SyntaxBrowserEquivalence|WebpackDevServer)\"",
73-
"test:base:bun": "bun --bun --smol --preload ./test/bun-preload.js ./node_modules/jest-cli/bin/jest.js --workerThreads --workerIdleMemoryLimit=512MB --logHeapUsage",
73+
"test:base:bun": "bun --bun --smol --preload ./test/bun-preload.js ./node_modules/jest-cli/bin/jest.js --workerThreads --workerIdleMemoryLimit=2048MB --logHeapUsage",
7474
"test:update-snapshots": "yarn test:base -u",
7575
"test:size": "node --max-old-space-size=4096 ./test/CodeSizeTestCases.size.js",
7676
"report:cover": "nyc report --reporter=lcov --reporter=text -t coverage",

0 commit comments

Comments
 (0)