]> git.kaiwu.me - nginx.git/commit
QUIC: avoid main connection reuse after creating a stream
authorRoman Arutyunyan <arut@nginx.com>
Sun, 1 Nov 2026 12:46:22 +0000 (16:46 +0400)
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>
Wed, 11 Nov 2026 12:17:24 +0000 (16:17 +0400)
commitb5252dae1ca0d4c516b8bcffd9fa7fd967b73075
treec0bbc4b75690d8ae53baf1318f552fe20806d541
parent1d1d861a5e30026c9b76f0760e616847a7601422
QUIC: avoid main connection reuse after creating a stream

Previously, ngx_quic_create_stream() cleared the main connection's
reusable flag and then called ngx_get_connection() before inserting the
new stream into the tree.  If the worker was low on free connections,
the drain inside ngx_get_connection() could close an idle stream of the
same main connection.  Since the new stream was not in the tree yet,
that close found no remaining streams and marked the main connection
reusable again.  Once reusable, the connection could later be drained
while processing one of its streams, for example when connecting to an
upstream, freeing it while still in use.

Fix is to insert the new stream into the tree before calling
ngx_get_connection(), so the main connection is not considered idle.

Reported by Xint.io.
src/event/quic/ngx_event_quic_streams.c