Skip to content

No-GIL debugger: make script and statement registries race-free #314

Description

@chrisbbreuer

CI: https://github.com/zig-utils/zig-js/actions/runs/29674163787/job/88158274698
Roadmap: #143
Related: #293

Root cause

The no-GIL PR-249 case jit/int-gate-stop-budget.js produced a
suppression-free TSan race between:

  • registerParsedDebugScript mutating the shared
    Context.debug_statement_locations AutoHashMap while a child constructs a
    dynamic Function; and
  • serviceDebugStatement reading the same map from another child.

The same transaction also mutates debug_scripts and
next_debug_script_id unsafely, so fixing only the reported map access would
leave duplicate IDs/list corruption latent.

Acceptance

  • Serialize script ID assignment, script-list publication, notify-hook
    installation/removal, location-map mutation, and all concurrent reads.
  • Keep single-threaded and GIL execution on the lock-free path.
  • Never expose a partially registered script/location record.
  • Add a deterministic multi-thread dynamic-Function witness with exact
    script-ID uniqueness and result checks.
  • Pass focused normal and suppression-free TSan tests.
  • Re-run the exact jit/int-gate-stop-budget.js TSan witness.
  • Observe a green replacement full CI shard before closing.

Local evidence

  • zig build test -Dtest-filter="debug registry": 3/3 passed.
  • zig build test -Dtest-filter="debug registry" -Dtsan=true: 3/3 passed,
    suppression-free.
  • zig build threads-test -Dthreads-parallel-js=true -Dthreads-case=jit/int-gate-stop-budget.js -Dtsan=true: 1/1 passed in
    26.3 seconds.
  • zig build test -Dtest-filter=inspector: 20/20 passed.

Activity

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