Skip to content

test: skip the test if the buffer allocation fails #58738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2025

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Jun 17, 2025

Use the error message as another condition to skip the test when the buffer allocation fails.

Refs: 795dd8eb7988ae38553e
Refs: e9c6004a2d580008082b

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Jun 17, 2025
@lpinca
Copy link
Member Author

lpinca commented Jun 17, 2025

This should fix

https://ci.nodejs.org/job/node-test-binary-windows-js-suites/34803/RUN_SUBSET=3,nodes=win11-COMPILED_BY-vs2022_clang/testReport/junit/(root)/pummel/test_buffer_large_size_buffer_write/

---
duration_ms: 128.011
exitcode: 1
severity: fail
stack: |-
  c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-buffer-large-size-buffer-write.js:19
      throw e;
      ^

  RangeError: Array buffer allocation failed
      at new ArrayBuffer (<anonymous>)
      at new Uint8Array (<anonymous>)
      at new FastBuffer (node:internal/buffer:968:5)
      at Buffer.alloc (node:buffer:399:10)
      at Object.<anonymous> (c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-buffer-large-size-buffer-write.js:14:22)
      at Module._compile (node:internal/modules/cjs/loader:1691:14)
      at Object..js (node:internal/modules/cjs/loader:1823:10)
      at Module.load (node:internal/modules/cjs/loader:1426:32)
      at Module._load (node:internal/modules/cjs/loader:1249:12)
      at TracingChannel.traceSync (node:diagnostics_channel:322:14)

  Node.js v25.0.0-pre
...

https://ci.nodejs.org/job/node-test-binary-windows-js-suites/34840/RUN_SUBSET=2,nodes=win11-COMPILED_BY-vs2022_clang/testReport/junit/(root)/pummel/test_buffer_large_size_buffer_alloc_unsafe_slow/

---
duration_ms: 161.012
exitcode: 1
severity: fail
stack: |-
  c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-buffer-large-size-buffer-alloc-unsafe-slow.js:15
      throw e;
      ^

  AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
  + actual - expected

  + Comparison {}
  - Comparison {
  -   code: 'ERR_STRING_TOO_LONG'
  - }

      at Object.<anonymous> (c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-buffer-large-size-buffer-alloc-unsafe-slow.js:12:10)
      at Module._compile (node:internal/modules/cjs/loader:1691:14)
      at Object..js (node:internal/modules/cjs/loader:1823:10)
      at Module.load (node:internal/modules/cjs/loader:1426:32)
      at Module._load (node:internal/modules/cjs/loader:1249:12)
      at TracingChannel.traceSync (node:diagnostics_channel:322:14)
      at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
      at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:152:5)
      at node:internal/main/run_main_module:33:47 {
    generatedMessage: true,
    code: 'ERR_ASSERTION',
    actual: RangeError: Array buffer allocation failed
        at new ArrayBuffer (<anonymous>)
        at new Uint8Array (<anonymous>)
        at new FastBuffer (node:internal/buffer:968:5)
        at createUnsafeBuffer (node:internal/buffer:1114:12)
        at Buffer.allocUnsafeSlow (node:buffer:418:10)
        at assert.throws.code (c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-buffer-large-size-buffer-alloc-unsafe-slow.js:12:30)
        at getActual (node:assert:505:5)
        at ok.throws (node:assert:651:24)
        at Object.<anonymous> (c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-buffer-large-size-buffer-alloc-unsafe-slow.js:12:10)
        at Module._compile (node:internal/modules/cjs/loader:1691:14),
    expected: { code: 'ERR_STRING_TOO_LONG' },
    operator: 'throws'
  }

  Node.js v25.0.0-pre
...

https://ci.nodejs.org/job/node-test-binary-windows-js-suites/34840/RUN_SUBSET=2,nodes=win11-COMPILED_BY-vs2022_clang/testReport/junit/(root)/pummel/test_buffer_large_size_slowbuffer/

---
duration_ms: 168.372
exitcode: 1
severity: fail
stack: |-
  c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-buffer-large-size-slowbuffer.js:19
      throw e;
      ^

  AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
  + actual - expected

  + Comparison {}
  - Comparison {
  -   code: 'ERR_STRING_TOO_LONG'
  - }

      at Object.<anonymous> (c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-buffer-large-size-slowbuffer.js:14:10)
      at Module._compile (node:internal/modules/cjs/loader:1691:14)
      at Object..js (node:internal/modules/cjs/loader:1823:10)
      at Module.load (node:internal/modules/cjs/loader:1426:32)
      at Module._load (node:internal/modules/cjs/loader:1249:12)
      at TracingChannel.traceSync (node:diagnostics_channel:322:14)
      at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
      at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:152:5)
      at node:internal/main/run_main_module:33:47 {
    generatedMessage: true,
    code: 'ERR_ASSERTION',
    actual: RangeError: Array buffer allocation failed
        at new ArrayBuffer (<anonymous>)
        at new Uint8Array (<anonymous>)
        at new FastBuffer (node:internal/buffer:968:5)
        at createUnsafeBuffer (node:internal/buffer:1114:12)
        at Buffer.allocUnsafeSlow (node:buffer:418:10)
        at assert.throws.code (c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-buffer-large-size-slowbuffer.js:14:30)
        at getActual (node:assert:505:5)
        at ok.throws (node:assert:651:24)
        at Object.<anonymous> (c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-buffer-large-size-slowbuffer.js:14:10)
        at Module._compile (node:internal/modules/cjs/loader:1691:14),
    expected: { code: 'ERR_STRING_TOO_LONG' },
    operator: 'throws'
  }

  Node.js v25.0.0-pre
...

https://ci.nodejs.org/job/node-test-binary-windows-js-suites/34840/RUN_SUBSET=2,nodes=win11-COMPILED_BY-vs2022_clang/testReport/junit/(root)/pummel/test_string_decoder_large_buffer/

---
duration_ms: 174.014
exitcode: 1
severity: fail
stack: |-
  c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-string-decoder-large-buffer.js:26
      throw e;
      ^

  RangeError: Array buffer allocation failed
      at new ArrayBuffer (<anonymous>)
      at new Uint8Array (<anonymous>)
      at new FastBuffer (node:internal/buffer:968:5)
      at createUnsafeBuffer (node:internal/buffer:1114:12)
      at allocate (node:buffer:433:10)
      at Buffer.allocUnsafe (node:buffer:408:10)
      at Object.<anonymous> (c:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-string-decoder-large-buffer.js:21:22)
      at Module._compile (node:internal/modules/cjs/loader:1691:14)
      at Object..js (node:internal/modules/cjs/loader:1823:10)
      at Module.load (node:internal/modules/cjs/loader:1426:32)

  Node.js v25.0.0-pre
...

Use the error message as another condition to skip the test when the
buffer allocation fails.

Refs: nodejs@795dd8eb7988ae38553e
Refs: nodejs@e9c6004a2d580008082b
@lpinca lpinca force-pushed the fix/flaky-tests branch from e4e25da to b65339b Compare June 17, 2025 08:34
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.12%. Comparing base (0722023) to head (fdb2c4b).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58738      +/-   ##
==========================================
- Coverage   90.16%   90.12%   -0.04%     
==========================================
  Files         637      639       +2     
  Lines      188126   188201      +75     
  Branches    36886    36909      +23     
==========================================
- Hits       169620   169617       -3     
- Misses      11272    11330      +58     
- Partials     7234     7254      +20     

see 46 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lpinca lpinca added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 17, 2025
@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Jun 17, 2025

This comment was marked as outdated.

@LiviaMedeiros LiviaMedeiros added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. labels Jun 17, 2025
Co-authored-by: Livia Medeiros <livia@cirno.name>
@lpinca lpinca added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Jun 17, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 17, 2025
@nodejs-github-bot
Copy link
Collaborator

@LiviaMedeiros
Copy link
Member

https://ci.nodejs.org/job/node-test-binary-windows-js-suites/34850/RUN_SUBSET=3,nodes=win11-COMPILED_BY-vs2022_clang/testReport/junit/(root)/pummel/test_string_decoder_large_buffer/

---
duration_ms: 203.164
exitcode: 134
severity: fail
stack: |2-

  <--- Last few GCs --->

  FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
  ----- Native stack trace -----

   1: 00007FF6857BD5B9
   2: 00007FF686409447
   3: 00007FF686208E77
   4: 00007FF6861E8E1E
   5: 00007FF6861DE4AC
   6: 00007FF6861DE15C
   7: 00007FF6861DDDA1
   8: 00007FF6861F0058
   9: 00007FF686AB6D7D
  10: 00007FF686AB7092
  11: 00007FF6861E0E14
  12: 00007FF6861C8733
  13: 00007FF6861C26D4
  14: 00007FF68620B3DA
  15: 00007FF68620A8C6
  16: 00007FF68621BE1E
  17: 00007FF68621B93B
  18: 00007FF68756CAAD
  19: 00007FF6862068E6
  20: 00007FF6862085ED
  21: 00007FF685FF37DA
  22: 00007FF685FF366B
  23: 00007FF6863DFB8A
  24: 00007FF6863DF03B
  25: 0000019737E78AFA
...

@joyeecheung
Copy link
Member

Regarding the OOM issue - maybe adding something like --max-old-space-size=8000 would help, the default size is ~4GB AFAICT, which doesn't give a lot of wiggle room since the buffer alone is ~4GB.

@nodejs-github-bot
Copy link
Collaborator

@lpinca lpinca added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 20, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 20, 2025
@nodejs-github-bot nodejs-github-bot merged commit 3d608bb into nodejs:main Jun 20, 2025
60 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 3d608bb

@lpinca lpinca deleted the fix/flaky-tests branch June 20, 2025 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants