Merge pull request #3029 from murgatroid99/grpc-js_keepalive_fix_backport

Backport "Fix server keep alive timeout not properly destroying connections" to 1.14.x
This commit is contained in:
Michael Lumish 2025-12-02 07:08:01 -08:00 committed by GitHub
commit bf0dc8fb72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "1.14.1",
"version": "1.14.2",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

View File

@ -1609,7 +1609,7 @@ export class Server {
if (err) {
this.keepaliveTrace('Ping failed with error: ' + err.message);
sessionClosedByServer = true;
session.close();
session.destroy();
} else {
this.keepaliveTrace('Received ping response');
maybeStartKeepalivePingTimer();
@ -1631,7 +1631,7 @@ export class Server {
'Connection dropped due to ping send error: ' + pingSendError
);
sessionClosedByServer = true;
session.close();
session.destroy();
return;
}
@ -1640,7 +1640,7 @@ export class Server {
this.keepaliveTrace('Ping timeout passed without response');
this.trace('Connection dropped by keepalive timeout');
sessionClosedByServer = true;
session.close();
session.destroy();
}, this.keepaliveTimeoutMs);
keepaliveTimer.unref?.();
};
@ -1803,7 +1803,7 @@ export class Server {
duration
);
sessionClosedByServer = true;
session.close();
session.destroy();
} else {
this.keepaliveTrace('Received ping response');
maybeStartKeepalivePingTimer();
@ -1826,7 +1826,7 @@ export class Server {
'Connection dropped due to ping send error: ' + pingSendError
);
sessionClosedByServer = true;
session.close();
session.destroy();
return;
}
@ -1840,7 +1840,7 @@ export class Server {
'Connection dropped by keepalive timeout from ' + clientAddress
);
sessionClosedByServer = true;
session.close();
session.destroy();
}, this.keepaliveTimeoutMs);
keepaliveTimeout.unref?.();
};