Skip to content

Segfault in ShellInterpreter finalizer during garbage collection #23177

@coleleavitt

Description

@coleleavitt

How can we reproduce the crash?

Clear cached resolve/reject JSValues before destroying the interpreter
to prevent GC from accessing freed memory during heap sweep.

The finalizer was not clearing the WriteBarrier fields (m_resolve and
m_reject) before destroying the object, causing JavaScriptCore's garbage
collector to access invalid memory during sweepPreciseAllocations.

will attach a PR to this issue

Relevant log output

Stack Trace (bun.report)

Bun v1.2.21 (7c45ed9) on windows x86_64_baseline [AutoCommand]

Segmentation fault at address 0x22F7E6E0120

Features: transpiler_cache, tsconfig, tsconfig_paths, Bun.stderr, Bun.stdin, Bun.stdout, dotenv, fetch, http_server, jsc, shell, spawn, standalone_executable, standalone_executable

Sentry Issue: BUN-SPG

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashAn issue that could cause a crashshellSomething to do with Bun as a shellwindowsAn issue that is known to occur on Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions