Skip to content

http: RangeError #59772

Description

@ronag

Node.js v24.6.0

This should not be possible... looks like a node core bug to me

RangeError [ERR_OUT_OF_RANGE]: The value of "msecs" is out of range. It must be a non-negative finite number. Received NaN
    at getTimerDuration (node:internal/timers:425:11)
    at TLSSocket.setStreamTimeout [as setTimeout] (node:internal/stream_base_commons:243:11)
    at resOnFinish (node:_http_server:1032:14)
    at ServerResponse.emit (node:events:508:28)
    at onFinish (node:_http_outgoing:1024:10)
    at callback (node:internal/streams/writable:764:21)
    at afterWrite (node:internal/streams/writable:708:5)
    at onwrite (node:internal/streams/writable:686:7)
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:105:10)

Activity

  1. added
    httpIssues and PRs related to the http subsystem.
    on Sep 5, 2025
  2. ronag commented on Sep 5, 2025

    @ronag
    MemberAuthor
  3. ronag commented on Sep 6, 2025

    @ronag
    MemberAuthor

    I think this might be related to http2 to http1 fallback. @nodejs/http2 Not sure I quite follow the logic yet...

  4. ronag commented on Sep 6, 2025

    @ronag
    MemberAuthor

    Found what causes this:

    import http2 from 'node:http2'
    import https from 'node:https'
    import { readFileSync } from 'node:fs'
    
    const server = http2.createSecureServer({
      key: readFileSync('../proxy/cert/server.key'),
      cert: readFileSync('../proxy/cert/server.crt'),
      allowHTTP1: true,
    })
    .on('request', (req, res) => {
      console.log(req.httpVersion, server.keepAliveTimeout, server.keepAliveTimeoutBuffer) // 1.1 undefined undefined
    })
    .listen(9999)
    
    server.keepAliveTimeout = 1e3
    
    https.get('https://localhost:9999', { rejectUnauthorized: false }, (res) => {
      res.end()
    })
  5. added
    http2Issues and PRs related to the http2 subsystem.
    on Sep 6, 2025
  6. haramj commented on Sep 6, 2025

    @haramj
    Member

    @ronag
    I recently opened PR #59243 (http: add server.keepAliveTimeoutBuffer option),
    which touches a similar area of the HTTP keep-alive handling.

    I thought this issue might be related to keepAliveTimeout /
    keepAliveTimeoutBuffer being left undefined when falling back from HTTP/2 to HTTP/1.

    I now see that follow-up PRs (#59773, #59784) are already in progress to fix this.
    Sorry for the noise..

  7. trivikr commented on May 20, 2026

    @trivikr
    Member

    Closing as this issue was fixed in #59784

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

    httpIssues and PRs related to the http subsystem.http2Issues and PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions