[quic] ngx_quic_input_handler Segmentation fault because c->udp->dgram is null

Vladimir Homutov vl at nginx.com
Mon Jan 31 07:18:51 UTC 2022

On Fri, Jan 28, 2022 at 02:09:31PM +0000, Gao,Yan(媒体云) wrote:
> > c->quic is never set on main connection (it is not really needed there).
> > ngx_http_v3_init() is first called with main connection, and later it is
> > called with _another_ connection that is a stream, and it has c->quic set.
> > ngx_ssl_shutdown() is not supposed to do something on stream
> > connections, ssl object is shared with main connection. all necessary
> > cleanup will be done by main connection handlers.
> ngx_http_v3_init() is only called in ngx_http_init_connection, as ls->handler.
> And then ngx_quic_listen add the main quic connection to udp rbtree.
> It call main quic connection read->handler If find connection in
> ngx_lookup_udp_connection, else call ls->handler.

> But when ngx_http_v3_init() is called by _another_ connection that is a stream?

the ngx_http_v3_init() may be called with either main or stream quic

for main connection c->quic is NULL, and ngx_quic_run() is invoked,
after that it returns.

if c->quic is set, then ngx_http_v3_init() proceeds further, and
initializes HTTP/3 stream and proceeds to processing requests.

More information about the nginx-devel mailing list