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!

Related questions

--max-http-header-size= is not allowed in NODE_OPTIONS
Crash with "req.handle.writev is not a function" on Socket.Writable.uncork hot 2
pkg-exports: "." errors without a specified `main` hot 2
shutdown ENOTCONN on TLS.Socket._final hot 2
Assertion `(parser->current_buffer_len_) == (0)' failed hot 1
Node.js 12.10 throwing EPROTO on HTTPS request hot 1
Remove util.inherits usage internally? hot 1
[Bug] Node 10.1.0 TLS issue with ldap: Client network socket disconnected before secure TLS connection was established hot 1
ReferenceError: internalBinding is not defined hot 1
Incorrect timezone hot 1
HPE_INVALID_HEADER_TOKEN on http requests hot 1
HPE_INVALID_HEADER_TOKEN on http requests hot 1
crypto, bad decrypt hot 1
stream.finished behaviour change hot 1
display node.js version (process.version) at the end of stacktraces hot 1
Github User Rank List