Skip to content

fix(domain): route emitter errors through domains#4398

Merged
proggeramlug merged 3 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-domain-emitter-error-routing
Jun 4, 2026
Merged

fix(domain): route emitter errors through domains#4398
proggeramlug merged 3 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-domain-emitter-error-routing

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

@andrewtdiz andrewtdiz commented Jun 4, 2026

Fixes #4395.

Summary

  • give optimized perry-ext-events EventEmitter handles a local registry with GC scanning and runtime registration hooks
  • expose domain get/set hooks through the runtime class handle registry so domain.add/remove(emitter) works for optimized EventEmitter handles in auto and full-stdlib builds
  • route unhandled error emits through the owning domain after releasing emitter borrows, matching Node's emit("error") return shape
  • decode module-level node:events helper targets from the NaN-boxed ABI used by codegen
  • localize Rust allocator globals in well-known wrapper archives so wrapper staticlibs cannot override the runtime allocator during links

Validation

  • cargo check -p perry-ext-events
  • cargo test -p perry strip_dedup -- --nocapture
  • cargo check -p perry
  • cargo build -p perry --release
  • cargo build -p perry-ext-events --release
  • PERRY_NO_AUTO_OPTIMIZE=1 PERRY_NO_CACHE=1 PERRY_ALLOW_UNIMPLEMENTED=1 target/release/perry test-parity/node-suite/events/imports/named-imports.ts -o /tmp/perry_events_named_imports && /tmp/perry_events_named_imports
  • PATH=/root/.npm/_npx/bac97da9607b7ef2/node_modules/node/bin:$PATH PERRY_NO_AUTO_OPTIMIZE=1 PERRY_NO_CACHE=1 ./run_parity_tests.sh --suite node-suite --module events --filter imports (PASS 3, report test-parity/reports/parity_report_20260604_132124.json)
  • PATH=/root/.npm/_npx/bac97da9607b7ef2/node_modules/node/bin:$PATH PERRY_NO_AUTO_OPTIMIZE=1 PERRY_NO_CACHE=1 ./run_parity_tests.sh --suite node-suite --module domain --filter members-emitter-errors (PASS 1, report test-parity/reports/parity_report_20260604_132243.json)

Note: the broader events --filter emitter run still has unrelated parity gaps in capture-rejections, emit-multiple-args, event-names-symbols, and instanceof; the focused domain regression and events import fixtures pass.

@andrewtdiz andrewtdiz force-pushed the codex/node-domain-emitter-error-routing branch from 4a9679e to 2704a6c Compare June 4, 2026 13:23
@proggeramlug proggeramlug marked this pull request as ready for review June 4, 2026 15:53
@proggeramlug proggeramlug merged commit ef36824 into PerryTS:main Jun 4, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:domain: EventEmitter domain error routing segfaults

2 participants