Welcome! Log In Create A New Profile

Advanced

Re: keepalive not work with grpc

August 10, 2018 03:10AM
I found the problem.
I used the wireshark to analyse the packets between nginx server and grpc server and I found that in the last packet from grpc server to nginx client, there are five frames,SETTINGS, HEADERS, DATA, HEADERS, WINDOW_UPDATE. The second HEADERS set the 'end_stream' and ngx_http_grpc_filter checked it
(about the 2100th line in the ngx_http_grpc_module.c)
if (ctx->end_stream) {
u->length = 0;

if (ctx->in == NULL
&& ctx->out == NULL
&& ctx->output_closed
&& b->last == b->pos)
{
u->keepalive = 1;
}

return NGX_OK;
}
everthing is true but b->last == b->pos
because there is still a WINDOW_UPDATE frame in buffer and the difference between b->last and b->pos just is the length of WINDOW_UPDATE frame.
That's why keepalive in the upstream not work, it is not set by the grpc module.
Please check the bug. The keepalive problem also happens between grpc client and nginx but it is not so serious like this one but it needs your attention, too.
Subject Author Posted

keepalive not work with grpc

hunterqin August 05, 2018 11:21PM

Re: keepalive not work with grpc

hunterqin August 10, 2018 03:10AM

Re: keepalive not work with grpc

Maxim Dounin August 10, 2018 06:20AM

Re: keepalive not work with grpc

hunterqin August 17, 2018 03:36AM

Re: keepalive not work with grpc

Maxim Dounin August 21, 2018 10:00PM

Re: keepalive not work with grpc

hunterqin August 22, 2018 12:07AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 307
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready