Welcome! Log In Create A New Profile

Advanced

[nginx] Upstream: fixed timeouts with gRPC, SSL and select (ticket #2229).

Maxim Dounin
November 16, 2021 09:56AM
details: https://hg.nginx.org/nginx/rev/5d09596909c6
branches: stable-1.20
changeset: 7966:5d09596909c6
user: Maxim Dounin <mdounin@mdounin.ru>
date: Fri Aug 20 03:53:56 2021 +0300
description:
Upstream: fixed timeouts with gRPC, SSL and select (ticket #2229).

With SSL it is possible that an established connection is ready for
reading after the handshake. Further, events might be already disabled
in case of level-triggered event methods. If this happens and
ngx_http_upstream_send_request() blocks waiting for some data from
the upstream, such as flow control in case of gRPC, the connection
will time out due to no read events on the upstream connection.

Fix is to explicitly check the c->read->ready flag if sending request
blocks and post a read event if it is set.

Note that while it is possible to modify ngx_ssl_handshake() to keep
read events active, this won't completely resolve the issue, since
there can be data already received during the SSL handshake
(see 573bd30e46b4).

diffstat:

src/http/ngx_http_upstream.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diffs (14 lines):

diff -r f2bbbc0ccdfb -r 5d09596909c6 src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c Tue Aug 10 23:43:17 2021 +0300
+++ b/src/http/ngx_http_upstream.c Fri Aug 20 03:53:56 2021 +0300
@@ -2062,6 +2062,10 @@ ngx_http_upstream_send_request(ngx_http_
c->tcp_nopush = NGX_TCP_NOPUSH_UNSET;
}

+ if (c->read->ready) {
+ ngx_post_event(c->read, &ngx_posted_events);
+ }
+
return;
}

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

[nginx] Upstream: fixed timeouts with gRPC, SSL and select (ticket #2229).

Maxim Dounin 262 November 16, 2021 09:56AM



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

Online Users

Guests: 159
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