Skip to content

HTTP/2 requests eventually start throwing NGHTTP2_ENHANCE_YOUR_CALM errors #27416

@akukas

Description

@akukas
  • Version: v12.0.0, v11.14.0
  • Platform: Windows 10 64bit, Ubuntu 18.04.2
  • Subsystem: http2

I've experienced an issue similar to #23116 on more recent Node versions. After a certain amount of requests are processed in the same http2 session, further requests will start throwing errors:

Error [ERR_HTTP2_STREAM_ERROR]: Stream closed with error code NGHTTP2_ENHANCE_YOUR_CALM
    at ClientHttp2Stream._destroy (internal/http2/core.js:1951:13)
    at ClientHttp2Stream.destroy (internal/streams/destroy.js:37:8)
    at ClientHttp2Stream.[kMaybeDestroy] (internal/http2/core.js:1967:12)
    at Http2Stream.onStreamClose (internal/http2/core.js:388:26)

I've used https://gist.github.com/akukas/46f5a850bb53cd95a887df16b75fd8a4 for testing. With maxSessionMemory set to 1 (the minimum value), the client session will make it through ~48k requests before failing. Increasing the memory limit will increase the number of requests proportionally. In Node v10.15.3, the test script will work as expected, running indefinitely.

Something else I noticed while watching the process in Task Manager/htop is that memory usage of the process remains static. Could it be that the http2 session isn't actually running out of memory, but there's just a memory usage tracking issue making it think it is?

Metadata

Metadata

Assignees

No one assigned

    Labels

    http2Issues or 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