Skip to content

v24: node:test file process dies with SIGSEGV in v8::base::RecursiveMutex::Lock after all its tests passed (~0.6%) #67984

Backlog

Description

@miguel-heygen

Version

v24.23.0 (also seen with the Node inside Electron 44.10.0, v24.22.1). Not seen on v22.23.4.

Platform

Linux x64 (GitHub-hosted Ubuntu runner and an Ubuntu 24 VM)

Subsystem

deps/v8 (or test_runner / process exit)

What steps will reproduce the bug?

I do not have a small reproduction. A large node --test suite (about 450 files, each file its own process, --test-concurrency=4) loses roughly one file in 200 to a SIGSEGV. Every test in the file has already reported ok; then the file's process dies and the runner reports the file as failed:

not ok 1 - tests/<file>.test.mjs
  failureType: 'testCodeFailure'
  exitCode: ~
  signal: 'SIGSEGV'
  error: 'test failed'
  code: 'ERR_TEST_FAILURE'

Re-running the same file passes. What I measured by running single files in a loop (node --test --test-reporter=tap <file>, counting signal: 'SIGSEGV'):

  • v24.23.0: 3 crashes in 480 runs, with or without NODE_V8_COVERAGE set
  • v22.23.4: 0 in 240 runs (with coverage)
  • It needs a file with several tests in one process; a single test in the file did not reproduce it in my runs.

A core dump from one of these crashes shows the main thread stopped in a mutex lock; gdb printed one frame for it:

#0  0x0000000002837ec2 in v8::base::RecursiveMutex::Lock() ()

The other threads in the core are idle platform workers (node::(anonymous namespace)::PlatformWorkerThread waiting on uv_cond_wait). The binary has no symbols beyond that.

What is the expected behavior?

The process exits with code 0 once the tests have passed.

What do you see instead?

SIGSEGV during process teardown.

Additional information

Only a guess, not something I verified: V8 a6eaf75741 ("[logging] Use RecursiveMutex for Logger", V8 12.7, see also #65140) put a RecursiveMutex on the logger path, which Node 22's V8 12.4 does not have. If the logger or another object guarded by that mutex is destroyed or locked while a thread still uses it at isolate teardown, it would look like this. I can run a debug build or a version bisect on the loop above if that helps.

Activity

  1. added
    help wanted
    test_runner
    needs more info
    and removed
    help wanted
    on Dec 3, 2026
  2. Renegade334 commented on Dec 4, 2026

    @Renegade334
    Member

    What I measured by running single files in a loop (node --test --test-reporter=tap <file>, counting signal: 'SIGSEGV'):

    * v24.23.0: 3 crashes in 480 runs, with or without `NODE_V8_COVERAGE` set
    
    * v22.23.4: 0 in 240 runs (with coverage)
    
    * It needs a file with several tests in one process; a single test in the file did not reproduce it in my runs.
    

    To clarify, this reproduction applies running a single test file, not just when running concurrent test files? Does it reproduce running the single test script without --test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more infotest_runner

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions