镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

timers: timer starvation #24320

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

Activity

  1. apapirovski commented on Nov 12, 2018

    @apapirovski
    Contributor

    Working on a PR 😓

  2. added
    confirmed-bugIssues and PRs for confirmed bugs.
    timersIssues and PRs related to timers, setImmediate(), setInterval(), and setTimeout().
    on Nov 12, 2018
  3. added a commit that references this issue on Nov 15, 2018
  4. Trott commented on Nov 15, 2018

    @Trott
    Member

    Fixed in 9ca5c52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.timersIssues and PRs related to timers, setImmediate(), setInterval(), and setTimeout().

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions