<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"\@等线";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
text-align:justify;
text-justify:inter-ideograph;
font-size:12.0pt;
font-family:DengXian;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:DengXian;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="ZH-CN" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">>
</span><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">The main quic connection is created in ngx_quic_new_connection(), which<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">>
</span><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">calls ngx_quic_open_sockets() and it sets c->udp for the first time.<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">>
</span><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">When packet arrives, c->udp is updated by ngx_lookup_udp_connection().<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">>
</span><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">The main connection does not have c->quic set; this is used in stream<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">>
</span><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">connections. To access main connection from quic stream, c->quic->parent<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">>
</span><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">may be used.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">ngx_event_recvmsg->(ls->handler)</span><span lang="EN-US">
</span><span lang="EN-US" style="font-size:10.5pt">ngx_http_init_connection->ngx_http_v3_init:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"> if (c->quic == NULL) {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"> h3scf->quic.timeout = clcf->keepalive_timeout;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"> ngx_quic_run(c, &h3scf->quic);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"> return;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:11.25pt"><span lang="EN-US" style="font-size:10.5pt">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">And, why check c->quic == NULL, as it is never set<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">c->read->handler = ngx_quic_input_handler; in ngx_quic_run.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">ngx_quic_close_connection maybe called in ngx_quic_input_handler, and it finally call ngx_ssl_shutdown(c), which cannot return immediately as c->quic is never set.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">And maybe ngx_handle_read_event add c->read to events group finally<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Gao,Yan(ACG VCP)
</span><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" align="left" style="text-align:left"><b><span style="font-family:宋体;color:black">发件人</span></b><b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">:
</span></b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">"Gao,Yan(</span><span style="font-family:宋体;color:black">媒体云</span><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">)" <gaoyan09@baidu.com><br>
</span><b><span style="font-family:宋体;color:black">日期</span></b><b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">:
</span></b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">2022</span><span style="font-family:宋体;color:black">年</span><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">1</span><span style="font-family:宋体;color:black">月</span><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">26</span><span style="font-family:宋体;color:black">日</span><span style="font-family:"Calibri",sans-serif;color:black">
</span><span style="font-family:宋体;color:black">星期三</span><span style="font-family:"Calibri",sans-serif;color:black">
</span><span style="font-family:宋体;color:black">下午</span><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">6:00<br>
</span><b><span style="font-family:宋体;color:black">收件人</span></b><b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">:
</span></b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">"nginx-devel@nginx.org" <nginx-devel@nginx.org><br>
</span><b><span style="font-family:宋体;color:black">主题</span></b><b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">:
</span></b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">Re: [quic] ngx_quic_input_handler Segmentation fault because c->udp->dgram is null<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-family:宋体"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">> the case you are describing is not what see in backtrace. And in<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">> described case connection is main quic connection which has process<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">> c->quic pointer set.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">I only find sc->quic = qs; in ngx_quic_create_stream</span><span style="font-size:10.5pt">,<span lang="EN-US">and this is stream connection, not the
</span></span><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">main quic connection.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri",sans-serif;color:black">How the main quic connection c->quic set?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">And the local code at this position:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">changeset: 8813:c37ea624c307<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">branch: quic<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">tag: tip<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">user: Roman Arutyunyan <arut@nginx.com><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">date: Fri Jan 21 11:20:18 2022 +0300<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">summary: QUIC: changed debug message.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Gao,Yan(ACG VCP)
</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>