Skip to content

domain: error handler runs outside of its domain

Before this change, domains' error handlers would run with the corresponding domain as the active domain. This creates the possibility for domains' error handlers to call themselves recursively if an event emitter created in the error handler emits an error, or if the error handler throws an error.

This change sets the active domain to be the domain's parent (or null if the domain for which the error handler is called has no parent) to prevent that from happening.

Fixes: https://github.com/nodejs/node/issues/26086

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Documentation not added yet, I'd like to discuss the changes first and whether folks would be open to that before digging into that.

@nodejs/domains Thoughts?

Merge request reports

Loading