Skip to content

timer,domain: timers don't maintain order after exception #1271

Closed
@bnoordhuis

Description

@bnoordhuis
var domain = require('domain').create();

domain.run(function() {
  setTimeout(function() { throw Error('FAIL'); }, 1);
  setTimeout(function() { console.log('timeout 1'); }, 1);
  setTimeout(function() { console.log('timeout 2'); }, 2);
});

domain.once('error', function() {});

Expected output:

timeout 1
timeout 2

Actual output:

timeout 2
timeout 1

(EDIT: I forgot to mention that you may need to run the test a few times.)

Metadata

Metadata

Assignees

Labels

confirmed-bugIssues with confirmed bugs.domainIssues and PRs related to the domain subsystem.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.timersIssues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions