details:   https://hg.nginx.org/nginx/rev/155c9093de9d
branches:  
changeset: 9236:155c9093de9d
user:      Vladimir Khomutov <v...@wbsrv.ru>
date:      Wed Apr 10 09:38:10 2024 +0300
description:
QUIC: fixed close timer processing with early data.

The ngx_quic_run() function uses qc->close timer to limit the handshake
duration.  Normally it is removed by ngx_quic_do_init_streams() which is
called once when we are done with initial SSL processing.

The problem happens when the client sends early data and streams are
initialized in the ngx_quic_run() -> ngx_quic_handle_datagram() call.
The order of set/remove timer calls is now reversed; the close timer is
set up and the timer fires when assigned, starting the unexpected connection
close process.

The fix is to skip setting the timer if streams were initialized during
handling of the initial datagram.  The idle timer for quic is set anyway,
and stream-related timeouts are managed by application layer.

diffstat:

 src/event/quic/ngx_event_quic.c |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r 99e7050ac886 -r 155c9093de9d src/event/quic/ngx_event_quic.c
--- a/src/event/quic/ngx_event_quic.c   Mon Feb 26 20:00:48 2024 +0000
+++ b/src/event/quic/ngx_event_quic.c   Wed Apr 10 09:38:10 2024 +0300
@@ -211,7 +211,10 @@ ngx_quic_run(ngx_connection_t *c, ngx_qu
     qc = ngx_quic_get_connection(c);
 
     ngx_add_timer(c->read, qc->tp.max_idle_timeout);
-    ngx_add_timer(&qc->close, qc->conf->handshake_timeout);
+
+    if (!qc->streams.initialized) {
+        ngx_add_timer(&qc->close, qc->conf->handshake_timeout);
+    }
 
     ngx_quic_connstate_dbg(c);
 
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to