[nginx] gRPC: reinitialization of ping and settings limits.

Maxim Dounin mdounin at mdounin.ru
Mon Aug 18 00:30:24 UTC 2025


details:   http://freenginx.org/hg/nginx/rev/47ecba793b8d
branches:  
changeset: 9406:47ecba793b8d
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Mon Aug 18 03:19:05 2025 +0300
description:
gRPC: reinitialization of ping and settings limits.

Allocations for PING and SETTINGS frames were limited in 7379:57463f4e2fcd
to prevent potential excessive memory usage due to misbehaving upstream
servers.  The limit as implemented applies to all interactions with all
upstream servers within an upstream, that is, if the limit is reached,
switching to the next upstream server is likely to hit the limit again
on the next PING (or SETTINGS) frame.  This is believed to be incorrect:
other upstream servers shouldn't be responsible for misbehaviour of the
previous one, and only allocations within a particular connection should
be limited.

Fix is to reset limits on request reinitialization.

diffstat:

 src/http/modules/ngx_http_grpc_module.c |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c
--- a/src/http/modules/ngx_http_grpc_module.c
+++ b/src/http/modules/ngx_http_grpc_module.c
@@ -1216,6 +1216,8 @@ ngx_http_grpc_reinit_request(ngx_http_re
     ctx->rst = 0;
     ctx->goaway = 0;
     ctx->connection = NULL;
+    ctx->pings = 0;
+    ctx->settings = 0;
 
     return NGX_OK;
 }


More information about the nginx-devel mailing list