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?
I've been running into the same issue. Not sure how to handle it for now.
Also seeing this issue with latest node v12. Increasing maxSessionMemory only prolongs the time until the issue occurs.
Tried this out across different versions, the issue is present on Node v11.11.0 and up.
Taking a quick look at the changelog, https://github.com/nodejs/node/commit/8a551b9d3b appears to be a possible cause, but I don't know what it could be.
@addaleax could you take a look at this?
@akukas Looks like that isn鈥檛 the issue, but instead my https://github.com/nodejs/node/pull/26207 is :) I鈥檒l take a look.
Yeah, this is 100聽% on me, sorry. @akukas Thank you for reporting this and pinging me!
https://github.com/nodejs/node/pull/27914 should address this.
Most helpful comment
Yeah, this is 100聽% on me, sorry. @akukas Thank you for reporting this and pinging me!
https://github.com/nodejs/node/pull/27914 should address this.