profile
viewpoint

Ask questionsHTTP/2 requests eventually start throwing NGHTTP2_ENHANCE_YOUR_CALM errors

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

I've experienced an issue similar to https://github.com/nodejs/node/issues/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?

nodejs/node

Answer questions crystalin

I've been running into the same issue. Not sure how to handle it for now.

useful!
source:https://uonfu.com/
Github User Rank List