<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="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cordia New";
panose-1:2 11 3 4 2 2 2 2 2 4;}
@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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.msoIns
{mso-style-type:export-only;
mso-style-name:"";
text-decoration:underline;
color:teal;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:3.0cm 2.0cm 3.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Anoop,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">He added <b>v</b> and <b>double quotes</b> around $binary_remote_addr.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best Regards,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">nginx <nginx-bounces@nginx.org> on behalf of Anoop Alias <anoopalias01@gmail.com><br>
<b>Reply-To: </b>"nginx@nginx.org" <nginx@nginx.org><br>
<b>Date: </b>Saturday, 30 September 2017 at 12.14<br>
<b>To: </b>Nginx <nginx@nginx.org><br>
<b>Subject: </b>Re: limit_conn is dropping valid connections and causing memory leaks on nginx reload<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt">What is the change (workaround) you made ?I don't see a difference?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-left:36.0pt">On Sat, Sep 30, 2017 at 3:35 PM, Dejan Grofelnik Pelzel <<a href="mailto:nginx-forum@forum.nginx.org" target="_blank">nginx-forum@forum.nginx.org</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal" style="margin-left:36.0pt">Hello,<br>
<br>
We are running the nginx 1.13.5 with HTTP/2 in a proxy_pass proxy_cache<br>
configuration with clients having relatively long open connections. Our<br>
system does automatic reloads for any new configuration and we recently<br>
introduced a limit_conn to some of the config files. After that, I've<br>
started noticing a rapid drop in connections and outgoing network every-time<br>
the system would perform a configuration reload. Even stranger, on every<br>
reload the memory usage would go up for about 1-2GB until ultimately<br>
everything crashed if the reloads were too frequent. The memory usage did go<br>
down after old workers were released, but that could take up to 30 minutes,<br>
while the configuration could get reloaded up to twice per minute.<br>
<br>
We used the following configuration as recommended by pretty much any<br>
example:<br>
limit_conn_zone $binary_remote_addr zone=1234con:10m;<br>
limit_conn zone1234con 10;<br>
<br>
I was able to verify the connection drop by doing a simple ab test, for<br>
example, I would run ab -c 100 -n -k 1000 <a href="https://127.0.0.1/file.bin" target="_blank">
https://127.0.0.1/file.bin</a><br>
990 of the connections went through, however, 10 would still be active.<br>
Immediately after the reload, those would get dropped as well. Adding -r<br>
option would help the problem, but that doesn't fix our problem.<br>
<br>
Finally, after I tried to create a workaround, I've configured the limit<br>
zone to:<br>
limit_conn_zone "v$binary_remote_addr" zone=1234con:10m;<br>
<br>
Suddenly everything magically started to work. The connections were not<br>
being dropped, the limit worked as expected and even more surprisingly the<br>
memory usage was not going up anymore. I've been tearing my hair out almost<br>
all day yesterday trying to figure this out. While I was very happy to see<br>
this resolved, I am now confused as to why nginx behaves in such a way.<br>
<br>
I'm thinking this might likely be a bug, so I'm just wondering if anyone<br>
could explain why it is happening or has a similar problem.<br>
<br>
Thank you!<br>
<br>
Posted at Nginx Forum: <a href="https://forum.nginx.org/read.php?2,276633,276633#msg-276633" target="_blank">
https://forum.nginx.org/read.php?2,276633,276633#msg-276633</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal" style="margin-left:36.0pt"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
</div>
<p class="MsoNormal" style="margin-left:36.0pt">-- <o:p></o:p></p>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><b>Anoop P Alias</b> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>