Welcome! Log In Create A New Profile

Advanced

[nginx] gRPC: handling GOAWAY with a higher last stream identifier.

Maxim Dounin
November 16, 2021 09:52AM
details: https://hg.nginx.org/nginx/rev/f5732fa038ad
branches: stable-1.20
changeset: 7957:f5732fa038ad
user: Sergey Kandaurov <pluknet@nginx.com>
date: Thu Jun 17 11:43:55 2021 +0300
description:
gRPC: handling GOAWAY with a higher last stream identifier.

Previously, once received from upstream, it couldn't limit
opening additional streams in a cached keepalive connection.

diffstat:

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

diffs (61 lines):

diff -r ae70fcb8ac93 -r f5732fa038ad src/http/modules/ngx_http_grpc_module.c
--- a/src/http/modules/ngx_http_grpc_module.c Tue Jun 01 17:37:51 2021 +0300
+++ b/src/http/modules/ngx_http_grpc_module.c Thu Jun 17 11:43:55 2021 +0300
@@ -124,6 +124,7 @@ typedef struct {
unsigned done:1;
unsigned status:1;
unsigned rst:1;
+ unsigned goaway:1;

ngx_http_request_t *request;

@@ -1213,6 +1214,7 @@ ngx_http_grpc_reinit_request(ngx_http_re
ctx->done = 0;
ctx->status = 0;
ctx->rst = 0;
+ ctx->goaway = 0;
ctx->connection = NULL;

return NGX_OK;
@@ -1568,6 +1570,7 @@ ngx_http_grpc_body_output_filter(void *d
&& ctx->out == NULL
&& ctx->output_closed
&& !ctx->output_blocked
+ && !ctx->goaway
&& ctx->state == ngx_http_grpc_st_start)
{
u->keepalive = 1;
@@ -1717,6 +1720,8 @@ ngx_http_grpc_process_header(ngx_http_re
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
}

+ ctx->goaway = 1;
+
continue;
}

@@ -1910,6 +1915,7 @@ ngx_http_grpc_process_header(ngx_http_re
&& ctx->out == NULL
&& ctx->output_closed
&& !ctx->output_blocked
+ && !ctx->goaway
&& b->last == b->pos)
{
u->keepalive = 1;
@@ -2038,6 +2044,7 @@ ngx_http_grpc_filter(void *data, ssize_t
if (ctx->in == NULL
&& ctx->output_closed
&& !ctx->output_blocked
+ && !ctx->goaway
&& ctx->state == ngx_http_grpc_st_start)
{
u->keepalive = 1;
@@ -2207,6 +2214,8 @@ ngx_http_grpc_filter(void *data, ssize_t
return NGX_ERROR;
}

+ ctx->goaway = 1;
+
continue;
}

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] gRPC: handling GOAWAY with a higher last stream identifier.

Maxim Dounin 54 November 16, 2021 09:52AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 78
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready