From e93a99d16f780846159423cabe48e51f979ed400 Mon Sep 17 00:00:00 2001 From: Sergey Zelenov Date: Thu, 5 Mar 2026 09:19:51 +0100 Subject: [PATCH 1/4] trigger OOM on CI --- test/integration/oom.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 test/integration/oom.test.ts diff --git a/test/integration/oom.test.ts b/test/integration/oom.test.ts new file mode 100644 index 0000000000..09b43b19b1 --- /dev/null +++ b/test/integration/oom.test.ts @@ -0,0 +1,8 @@ +describe.only('OOM exit code detection', function () { + it('allocates until OOM', function () { + const leak: Uint8Array[] = []; + while (true) { + leak.push(new Uint8Array(1_000_000)); + } + }); +}); From 3f2435baea4068b3ac4be6967214c088b7bc3df4 Mon Sep 17 00:00:00 2001 From: Sergey Zelenov Date: Thu, 5 Mar 2026 09:24:37 +0100 Subject: [PATCH 2/4] limit old-space-size --- .evergreen/config.in.yml | 1 + .evergreen/config.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index 29587cdc52..ed69e8d8c4 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -119,6 +119,7 @@ functions: params: env: TEST_CSFLE: "true" + NODE_OPTIONS: "--max-old-space-size=64" add_expansions_to_env: true working_dir: "src" timeout_secs: 300 diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 08808893c0..6ac1fcd4d4 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -93,6 +93,7 @@ functions: params: env: TEST_CSFLE: 'true' + NODE_OPTIONS: '--max-old-space-size=64' add_expansions_to_env: true working_dir: src timeout_secs: 300 From aa199963dff8d9185e6c3a39494bdf5df7bb6090 Mon Sep 17 00:00:00 2001 From: Sergey Zelenov Date: Thu, 5 Mar 2026 09:41:56 +0100 Subject: [PATCH 3/4] build regular object --- test/integration/oom.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/oom.test.ts b/test/integration/oom.test.ts index 09b43b19b1..9e6964b15b 100644 --- a/test/integration/oom.test.ts +++ b/test/integration/oom.test.ts @@ -1,8 +1,8 @@ describe.only('OOM exit code detection', function () { it('allocates until OOM', function () { - const leak: Uint8Array[] = []; + const leak: object[] = []; while (true) { - leak.push(new Uint8Array(1_000_000)); + leak.push({ a: Array.from({ length: 1_000 }, (_, i) => ({ i })) }); } }); }); From fb8b9358352da2e740487cdce78f9ab18cef5949 Mon Sep 17 00:00:00 2001 From: Sergey Zelenov Date: Thu, 5 Mar 2026 10:55:10 +0100 Subject: [PATCH 4/4] check layers --- .evergreen/run-tests.sh | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index 667f5cfc46..92ebc77f7b 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -58,4 +58,43 @@ export MONGODB_URI=${MONGODB_URI} export LOAD_BALANCER=${LOAD_BALANCER} export TEST_CSFLE=${TEST_CSFLE} export COMPRESSOR=${COMPRESSOR} -npm run check:integration-coverage + +# OOM exit code investigation - run through each layer and log exit codes +set +e + +OOM_TEST="test/integration/oom.test.ts" + +echo "=========================================" +echo "Layer 1: direct mocha" +echo "=========================================" +npx mocha --config test/mocha_mongodb.js "$OOM_TEST" +echo "EXIT CODE: $?" + +echo "=========================================" +echo "Layer 2: npm run check:test (npm -> mocha)" +echo "=========================================" +npm run check:test -- "$OOM_TEST" +echo "EXIT CODE: $?" + +echo "=========================================" +echo "Layer 3: nyc mocha (nyc -> mocha, no npm)" +echo "=========================================" +npx nyc mocha --config test/mocha_mongodb.js "$OOM_TEST" +echo "EXIT CODE: $?" + +echo "=========================================" +echo "Layer 4: nyc npm run check:test (nyc -> npm -> mocha)" +echo "=========================================" +npx nyc npm run check:test -- "$OOM_TEST" +echo "EXIT CODE: $?" + +echo "=========================================" +echo "Layer 5: npm run check:integration-coverage (npm -> nyc -> npm -> mocha)" +echo "=========================================" +npm run check:integration-coverage -- "$OOM_TEST" +echo "EXIT CODE: $?" + +echo "=========================================" +echo "DONE - any EXIT CODE of 0 above means that layer swallows the OOM" +echo "=========================================" +exit 1