Skip to content

Investigate macOS SIGSEGV while printing parser panic backtrace #926

Closed

Description

@AnthonyRonning

During validation of #925 (fba862c132eb98f3d1b048e272d3faeba070f3eb), the Research Rust unit-test process reproducibly crashed on macOS ARM64 with the pinned Rust 1.94.1 toolchain. This was local test execution; production was not involved.

The existing pdf_extractor::tests::parser_panic_is_contained_and_a_later_job_still_runs deliberately panics to verify that Tokio catches the parser failure and a later job succeeds. With the Nix shell's RUST_BACKTRACE=1, the process instead receives SIGSEGV while printing the backtrace.

Reproduce from the monorepo root after normal native test setup:

nix develop --no-update-lock-file .#ci -c bash -c '
  cd apps/maple-research/frontend/src-tauri &&
  RUST_BACKTRACE=1 cargo test --locked --lib \
    pdf_extractor::tests::parser_panic_is_contained_and_a_later_job_still_runs \
    -- --exact --nocapture
'

The macOS crash report shows a null access on tokio-rt-worker through:

libunwind::CFI_Parser::parseFDEInstructions
libunwind::UnwindCursor::getInfoFromDwarfSection
_Unwind_Backtrace
std::sys::backtrace::BacktraceLock::print
std::panicking::default_hook
pdf_extractor::tests::parser_panic_is_contained_and_a_later_job_still_runs

On the same executable, setting only RUST_BACKTRACE=0 makes both PDF and Word panic-containment tests pass. The full unchanged commit hook then passed: 1,003 frontend tests and 417 Rust tests, with the same two existing ignored tests. Stack printing was disabled; panic handling and assertions remained active.

The tests, hook, and flake are unchanged by #925. Earlier validation with local SDK links passed normally, so changed binary layout may expose the issue; its underlying cause and broader runtime applicability are not established.

Investigate the generated unwind information, linked libraries, and macOS unwinder interaction. Resolve the crash while retaining both panic-containment tests, and verify the targeted tests plus the full native suite with backtraces enabled. Do not treat the diagnostic-only workaround as a permanent fix.

Activity

  1. AnthonyRonning commented on Sep 15, 2026

    @AnthonyRonning
    ContributorAuthor

    Closing as unreproducible on current source. Reopen if a new debug build starts dying this way again.

    The synthetic panic! in parser_panic_is_contained_and_a_later_job_still_runs (and the Word twin) is expected: those tests prove Tokio turns a parser panic into an ordinary error and a later job still runs.

    The unexpected part was macOS libunwind SIGSEGV-ing while the default panic hook printed that backtrace (RUST_BACKTRACE=1 from the Nix shell). Panic containment never got a chance.

    On a fresh Maple-dev-env checkout this did not reproduce:

    • current origin/master (14889848): both panic tests pass with RUST_BACKTRACE=1 and RUST_BACKTRACE=full
    • the original commit fba862c after a clean maple rebuild: same, backtrace prints, tests pass

    It does still crash on the original 2026-09-14 test binary (app_lib-54f4add83496dab2) with RUST_BACKTRACE=1, and that same executable passes with RUST_BACKTRACE=0. That matches a layout-specific DWARF / compact-unwind interaction, not a logic bug in the tests or in parser isolation.

    RUST_BACKTRACE=0 remains a diagnostic workaround only, not a product change. CI Rust tests are Linux-only, so they would not have caught this. No source, hook, or flake change is included here.

    If a later native debug/test binary on macOS ARM64 dies in parseFDEInstructions / _Unwind_Backtrace while these tests run, reopen and keep that exact app_lib-* artifact.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions