Skip to content

AbortSignal.timeout throws RangeError with any decimal number input #58592

Description

@cprass

Version

v24.1.0

Platform


Subsystem

No response

What steps will reproduce the bug?

The bug is easy to reproduce using the timeout function with a decimal.

AbortSignal.timeout(1.1)

How often does it reproduce? Is there a required condition?

It always produces the same error.

What is the expected behavior? Why is that the expected behavior?

I'd expect it to work with all numbers, including decimal numbers, within the range of 0 and Number.MAX_SAFE_INTEGER. Browsers and other JS runtimes all seem to allow decimals. There is no mention of this special behavior in the NodeJS docs.

What do you see instead?

Uncaught:
RangeError [ERR_OUT_OF_RANGE]: The value of "delay" is out of range. It must be an integer. Received 1.1
    at AbortSignal.timeout (node:internal/abort_controller:239:5) {
  code: 'ERR_OUT_OF_RANGE'
}

Additional information

No response

Activity

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

    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions