Skip to content

process: do not directly schedule _tickCallback in _fatalException

When a process encounters a _fatalException that is caught, it should schedule execution of nextTicks but not in an arbitrary place of the next Immediates queue. Instead, add a no-op function to the queue that will ensure processImmediate runs, which will then ensure that nextTicks are processed at the end.

The current behaviour is counter-intuitive and can have completely unforeseen consequences because it allows for a _tickCallback to be scheduled anywhere within the setImmediate queue, which breaks the one basic rule of nextTick — that it runs when all the current operations complete.

CI: https://ci.nodejs.org/job/node-test-pull-request/12279/ CitGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1165/

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

process, test

Merge request reports

Loading