<div dir="ltr"><div><div><div><span style="font-family:arial,helvetica,sans-serif">http {<br></span></div><span style="font-family:arial,helvetica,sans-serif">    resolver 127.0.0.1;<br></span></div><span style="font-family:arial,helvetica,sans-serif">    resolver_timeout 1s;<br>
</span></div><div><span style="font-family:arial,helvetica,sans-serif">    server {    <br></span></div><div><span style="font-family:arial,helvetica,sans-serif">        listen 8000;<br></span></div><div><span style="font-family:arial,helvetica,sans-serif">        location /test {    <br>
</span></div><div><span style="font-family:arial,helvetica,sans-serif">            proxy_pass http://$arg_host:8080;<br></span></div><div><span style="font-family:arial,helvetica,sans-serif">        }<br>    }<br></span></div>
<div><span style="font-family:arial,helvetica,sans-serif">    server {<br></span></div><div><span style="font-family:arial,helvetica,sans-serif">        listen 8080;<br>        .......<br>    }<br></span></div><div><div><div>
<span style="font-family:arial,helvetica,sans-serif">}<br></span><div><span style="font-family:arial,helvetica,sans-serif">ps: other configure is normal<br><br>I have recently discoverd that when DNS server down, the first proxy request return 504 and than the follow proxy request may hang forever.<br>
</span></div><div><div id="gt-src-tools"><div id="gt-src-tools-l"><div style="display:inline-block" id="gt-input-tool"><div id="itamenu"><span class=""></span></div></div></div></div>   <div id="gt-res-content" class=""><div dir="ltr" style="zoom:1">
<span id="result_box" class="" lang="en"><span class="">I use</span> <span class="">two</span> <span class="">curl</span> <span class="">simulate concurrent</span> <span class="">requests<br><br></span></span></div></div>
</div><div><span style="font-family:arial,helvetica,sans-serif">I found than the first request timeout in 1 second and exit, also it delete the timeout timer. because another request waiting dns response, so nginx retry send dns query, but dns never response(because it down), it lead to the follow request hang and also no timer relate to it;<br clear="all">
</span></div><div><div><span style="font-family:arial,helvetica,sans-serif"><br>PS:base on nginx-1.7.4<br>-- <br></span><div dir="ltr"><div><span style="font-family:arial,helvetica,sans-serif">ywsample :)<br></span></div>
<div><div><span style="font-family:arial,helvetica,sans-serif"><br></span></div></div></div>
</div></div></div></div></div></div>