Skip to content

Commit 3bcd683

Browse files
eugene1gmarco-ippolito
authored andcommitted
http2: fix excessive CPU usage when using allowHTTP1=true
When Http2SecureServer is configured with `allowHTTP1=true`, it calls `setupConnectionsTracking` to start monitoring for idle HTTP1 connections. `setupConnectionsTracking` expects to have `this.connectionsCheckingInterval` property defined, but it does not exist on `Http2SecureServer`. This `undefined` value is passed to `setInterval`, which results in `checkConnections` being called on every tick, creating significant additional load on the server CPU. The fix is to define `this.connectionsCheckingInterval` on the Http2SecureServer instance. Refs: #51569 PR-URL: #52713 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent d4f1803 commit 3bcd683

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/internal/http2/core.js

+1
Original file line numberDiff line numberDiff line change
@@ -3185,6 +3185,7 @@ class Http2SecureServer extends TLSServer {
31853185
if (options.allowHTTP1 === true) {
31863186
this.headersTimeout = 60_000; // Minimum between 60 seconds or requestTimeout
31873187
this.requestTimeout = 300_000; // 5 minutes
3188+
this.connectionsCheckingInterval = 30_000; // 30 seconds
31883189
this.on('listening', setupConnectionsTracking);
31893190
}
31903191
if (typeof requestListener === 'function')

0 commit comments

Comments
 (0)