[njs] Fixed timeouts with Fetch, SSL and select.

Sergey Kandaurov pluknet at nginx.com
Wed Oct 6 12:58:32 UTC 2021


details:   https://hg.nginx.org/njs/rev/15a26b25a328
branches:  
changeset: 1712:15a26b25a328
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Wed Oct 06 15:57:14 2021 +0300
description:
Fixed timeouts with Fetch, SSL and select.

Similar to the connection hang fixed in 058a67435e83 in nginx,
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.

Fix is to post a read event if the c->read->ready flag is set.

diffstat:

 nginx/ngx_js_fetch.c |  4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diffs (14 lines):

diff -r 05a313868939 -r 15a26b25a328 nginx/ngx_js_fetch.c
--- a/nginx/ngx_js_fetch.c	Wed Sep 01 20:43:56 2021 +0200
+++ b/nginx/ngx_js_fetch.c	Wed Oct 06 15:57:14 2021 +0300
@@ -1007,6 +1007,10 @@ ngx_js_http_ssl_handshake(ngx_js_http_t 
         c->write->handler = ngx_js_http_write_handler;
         c->read->handler = ngx_js_http_read_handler;
 
+        if (c->read->ready) {
+            ngx_post_event(c->read, &ngx_posted_events);
+        }
+
         http->process = ngx_js_http_process_status_line;
         ngx_js_http_write_handler(c->write);
 


More information about the nginx-devel mailing list