Skip to content

timers: timer starvation #24320

Closed
Closed
@cjihrig

Description

@cjihrig
  • Version: 11.1.0 and master. 10.x is not impacted
  • Platform: macOS
  • Subsystem: timers

The following code should exit once the 110ms timer fires. Unfortunately, that never happens. Note, I tried including #24318, and that did not fix the issue either.

'use strict';
let client = null;

function serverBeat() {
  setTimeout(() => {}, 45);
  setTimeout(serverBeat, 50);
  clientBeat();
}

function clientBeat() {
  clearTimeout(client);
  client = setTimeout(clientBeat, 95);
}

setTimeout(() => {}, 10000);
setTimeout(serverBeat, 50);
setTimeout(() => {}, 120000);
clientBeat();

setTimeout(() => {
  console.log('finished!');
  process.exit();
}, 110);

Refs: hapijs/nes#257
cc: @nodejs/timers

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.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