Skip to content

[Bug]: Fix intermittent unit test failures in Node.js 24 #20251

@timvandermeij

Description

@timvandermeij

Attach (recommended) or Link to PDF file

N/A

Web browser and its version

Node.js 24

Operating system and its version

N/A

PDF.js version

master

Is the bug present in the latest PDF.js version?

No

Is a browser extension

No

Steps to reproduce the problem

  1. Open https://github.com/mozilla/pdf.js/actions/runs/17556274960/job/49877239388.
  2. Notice the following traceback:
[18:57:20] Starting 'runUnitTestCli'...
Randomized with seed 10717
Started


#
# Fatal error in , line 0
# Check failed: static_cast<int64_t>(amount_before) >= -delta.
#
#
#
#FailureMessage Object: 0x7ffe931246d0
----- Native stack trace -----

 1: 0x115b0e1  [node]
 2: 0x2e85da3 V8_Fatal(char const*, ...) [node]
 3: 0x163bb25  [node]
 4: 0x13c4873 v8::Isolate::AdjustAmountOfExternalAllocatedMemory(long) [node]
 5: 0x1040d50 napi_adjust_external_memory [node]
 6: 0x7f02660da6f3  [/home/runner/work/pdf.js/pdf.js/node_modules/@napi-rs/canvas-linux-x64-gnu/skia.linux-x64-gnu.node]
 7: 0x106452a void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*) [node]
 8: 0x1031138 v8impl::Reference::Finalize() [node]
 9: 0x105e948  [node]
10: 0x100a698 node::Environment::RunAndClearNativeImmediates(bool) [node]
11: 0x101b660 node::Environment::CheckImmediate(uv_check_s*) [node]
12: 0x212d139  [node]
13: 0x2124fb2 uv_run [node]
14: 0xf94055 node::SpinEventLoopInternal(node::Environment*) [node]
15: 0x1118eb2 node::NodeMainInstance::Run() [node]
16: 0x1059cb2 node::Start(int, char**) [node]
17: 0x7f02b7c2a1ca  [/lib/x86_64-linux-gnu/libc.so.6]
18: 0x7f02b7c2a28b __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
19: 0xf8e21e _start [node]
[18:57:25] 'runUnitTestCli' errored after 5.56 s
[18:57:25] Error: Unit tests failed.
    at ChildProcess.<anonymous> (file:///home/runner/work/pdf.js/pdf.js/gulpfile.mjs:2015:16)
    at ChildProcess.emit (node:events:508:28)
    at ChildProcess.emit (node:domain:552:15)
    at maybeClose (node:internal/child_process:1101:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
    at Process.callbackTrampoline (node:internal/async_hooks:130:17)
[18:57:25] 'unittestcli' errored after 34 s

What is the expected behavior?

The unit tests should pass consistently.

What went wrong?

The unit tests fail intermittently.

Link to a viewer

No response

Additional context

This only happens on Node.js 24 in the CI, and happens relatively often. It might be canvas-related, see Automattic/node-canvas#2514, but note that we don't (directly) use this library anymore.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions