<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>[BUG?] Nginx hangs when you use try_files, map, request_uri and long url.</title>
        <description> Hi,

For some reason, when I use long key with Map Module the whole nginx 
seems to hang.

Some background:
I have two backends, say old_app and new_app. both have own named 
locations, @new_app and old_app. In order to redirect urls I tried to use:

	map $request_uri $map_apps {
		default @new_app;
		/asd @old_app;
	}
	try_files /not_exist $map_apps;

And it was working, then I added another key, 70 chars long, with 
commas, - and numbers, like &amp;quot;/foo-bar,123,asd-qwe-asdasdasd&amp;quot;

since the keyword have 70 chars I had to change default 64 value of 
map_hash_bucket_size, I changed it to 128.

Now, if I access the '/foo-bar,123,asd-qwe-asdasdasd' url, nginx just 
hangs, firefox return 'connection reset', wget seems to retry every 3s 
with message 'no data'. I cant access any vhost, I cant even stop nginx, 
the workers ignore master, when I nginx -s stop, the workers are still 
alive, when I kill master with sigTERM, the workers are still alive, 
eventualy, after few minutes they starts working and support requests or 
just die.

The underlaying system is debian6, nginx version 1.1.19 (from 
squeeze-backports), 64bit.

even if I have only default entry in map, and then access the long url, 
the nginx hangs, but when I hash-out the map and try_files lines, I can 
access the url and see 404 error.

fwiw I tried to use map since I have about 100 URLs that I want to 
proxy_pass to old_app, rest have to be handled by new_app.

-- Piotr.

_______________________________________________
nginx mailing list
&amp;#110;&amp;#103;&amp;#105;&amp;#110;&amp;#120;&amp;#64;&amp;#110;&amp;#103;&amp;#105;&amp;#110;&amp;#120;&amp;#46;&amp;#111;&amp;#114;&amp;#103;
http://mailman.nginx.org/mailman/listinfo/nginx</description>
        <link>http://www.serverphorums.com/read.php?5,515524,515524#msg-515524</link>
        <lastBuildDate>Sun, 19 May 2013 01:39:10 +0200</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://www.serverphorums.com/read.php?5,515524,515838#msg-515838</guid>
            <title>Re: [BUG?] Nginx hangs when you use try_files, map, request_uri and long url.</title>
            <link>http://www.serverphorums.com/read.php?5,515524,515838#msg-515838</link>
            <description><![CDATA[ Hello.<br />
<br />
On 06/18/2012 10:02 PM, Maxim Dounin wrote:<br />
&gt; The problem isn't map, the problem is try_files which is broken in<br />
&gt; 1.1.19.  Please upgrade to 1.2.0 at least, or apply the following<br />
&gt; patch:<br />
&gt;<br />
&gt; <a href="http://trac.nginx.org/nginx/changeset/4601/nginx" target="_blank"  rel="nofollow">http://trac.nginx.org/nginx/changeset/4601/nginx</a><br />
&gt;<br />
&gt; Changes with nginx 1.2.0:<br />
&gt;<br />
&gt;      *) Bugfix: a segmentation fault might occur in a worker process if the<br />
&gt;         &quot;try_files&quot; directive was used; the bug had appeared in 1.1.19.<br />
<br />
Thank you very much Maxim, the patch works. ;-)<br />
<br />
-- Piotr.<br />
<br />
_______________________________________________<br />
nginx mailing list<br />
<a href="mailto:&#110;&#103;&#105;&#110;&#120;&#64;&#110;&#103;&#105;&#110;&#120;&#46;&#111;&#114;&#103;">&#110;&#103;&#105;&#110;&#120;&#64;&#110;&#103;&#105;&#110;&#120;&#46;&#111;&#114;&#103;</a><br />
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank"  rel="nofollow">http://mailman.nginx.org/mailman/listinfo/nginx</a>]]></description>
            <dc:creator>Piotr Karbowski</dc:creator>
            <category>Nginx</category>
            <pubDate>Tue, 19 Jun 2012 13:00:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?5,515524,515531#msg-515531</guid>
            <title>Re: [BUG?] Nginx hangs when you use try_files, map, request_uri and long url.</title>
            <link>http://www.serverphorums.com/read.php?5,515524,515531#msg-515531</link>
            <description><![CDATA[ Hello!<br />
<br />
On Mon, Jun 18, 2012 at 09:51:31PM +0200, Piotr Karbowski wrote:<br />
<br />
&gt; Hi,<br />
&gt; <br />
&gt; For some reason, when I use long key with Map Module the whole nginx<br />
&gt; seems to hang.<br />
&gt; <br />
&gt; Some background:<br />
&gt; I have two backends, say old_app and new_app. both have own named<br />
&gt; locations, @new_app and old_app. In order to redirect urls I tried<br />
&gt; to use:<br />
&gt; <br />
&gt; 	map $request_uri $map_apps {<br />
&gt; 		default @new_app;<br />
&gt; 		/asd @old_app;<br />
&gt; 	}<br />
&gt; 	try_files /not_exist $map_apps;<br />
&gt; <br />
&gt; And it was working, then I added another key, 70 chars long, with<br />
&gt; commas, - and numbers, like &quot;/foo-bar,123,asd-qwe-asdasdasd&quot;<br />
&gt; <br />
&gt; since the keyword have 70 chars I had to change default 64 value of<br />
&gt; map_hash_bucket_size, I changed it to 128.<br />
&gt; <br />
&gt; Now, if I access the '/foo-bar,123,asd-qwe-asdasdasd' url, nginx<br />
&gt; just hangs, firefox return 'connection reset', wget seems to retry<br />
&gt; every 3s with message 'no data'. I cant access any vhost, I cant<br />
&gt; even stop nginx, the workers ignore master, when I nginx -s stop,<br />
&gt; the workers are still alive, when I kill master with sigTERM, the<br />
&gt; workers are still alive, eventualy, after few minutes they starts<br />
&gt; working and support requests or just die.<br />
&gt; <br />
&gt; The underlaying system is debian6, nginx version 1.1.19 (from<br />
&gt; squeeze-backports), 64bit.<br />
&gt; <br />
&gt; even if I have only default entry in map, and then access the long<br />
&gt; url, the nginx hangs, but when I hash-out the map and try_files<br />
&gt; lines, I can access the url and see 404 error.<br />
&gt; <br />
&gt; fwiw I tried to use map since I have about 100 URLs that I want to<br />
&gt; proxy_pass to old_app, rest have to be handled by new_app.<br />
<br />
The problem isn't map, the problem is try_files which is broken in <br />
1.1.19.  Please upgrade to 1.2.0 at least, or apply the following <br />
patch:<br />
<br />
<a href="http://trac.nginx.org/nginx/changeset/4601/nginx" target="_blank"  rel="nofollow">http://trac.nginx.org/nginx/changeset/4601/nginx</a><br />
<br />
Changes with nginx 1.2.0:<br />
<br />
    *) Bugfix: a segmentation fault might occur in a worker process if the<br />
       &quot;try_files&quot; directive was used; the bug had appeared in 1.1.19.<br />
<br />
Maxim Dounin<br />
<br />
_______________________________________________<br />
nginx mailing list<br />
<a href="mailto:&#110;&#103;&#105;&#110;&#120;&#64;&#110;&#103;&#105;&#110;&#120;&#46;&#111;&#114;&#103;">&#110;&#103;&#105;&#110;&#120;&#64;&#110;&#103;&#105;&#110;&#120;&#46;&#111;&#114;&#103;</a><br />
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank"  rel="nofollow">http://mailman.nginx.org/mailman/listinfo/nginx</a>]]></description>
            <dc:creator>Maxim Dounin</dc:creator>
            <category>Nginx</category>
            <pubDate>Mon, 18 Jun 2012 22:10:04 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?5,515524,515524#msg-515524</guid>
            <title>[BUG?] Nginx hangs when you use try_files, map, request_uri and long url.</title>
            <link>http://www.serverphorums.com/read.php?5,515524,515524#msg-515524</link>
            <description><![CDATA[ Hi,<br />
<br />
For some reason, when I use long key with Map Module the whole nginx <br />
seems to hang.<br />
<br />
Some background:<br />
I have two backends, say old_app and new_app. both have own named <br />
locations, @new_app and old_app. In order to redirect urls I tried to use:<br />
<br />
	map $request_uri $map_apps {<br />
		default @new_app;<br />
		/asd @old_app;<br />
	}<br />
	try_files /not_exist $map_apps;<br />
<br />
And it was working, then I added another key, 70 chars long, with <br />
commas, - and numbers, like &quot;/foo-bar,123,asd-qwe-asdasdasd&quot;<br />
<br />
since the keyword have 70 chars I had to change default 64 value of <br />
map_hash_bucket_size, I changed it to 128.<br />
<br />
Now, if I access the '/foo-bar,123,asd-qwe-asdasdasd' url, nginx just <br />
hangs, firefox return 'connection reset', wget seems to retry every 3s <br />
with message 'no data'. I cant access any vhost, I cant even stop nginx, <br />
the workers ignore master, when I nginx -s stop, the workers are still <br />
alive, when I kill master with sigTERM, the workers are still alive, <br />
eventualy, after few minutes they starts working and support requests or <br />
just die.<br />
<br />
The underlaying system is debian6, nginx version 1.1.19 (from <br />
squeeze-backports), 64bit.<br />
<br />
even if I have only default entry in map, and then access the long url, <br />
the nginx hangs, but when I hash-out the map and try_files lines, I can <br />
access the url and see 404 error.<br />
<br />
fwiw I tried to use map since I have about 100 URLs that I want to <br />
proxy_pass to old_app, rest have to be handled by new_app.<br />
<br />
-- Piotr.<br />
<br />
_______________________________________________<br />
nginx mailing list<br />
<a href="mailto:&#110;&#103;&#105;&#110;&#120;&#64;&#110;&#103;&#105;&#110;&#120;&#46;&#111;&#114;&#103;">&#110;&#103;&#105;&#110;&#120;&#64;&#110;&#103;&#105;&#110;&#120;&#46;&#111;&#114;&#103;</a><br />
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank"  rel="nofollow">http://mailman.nginx.org/mailman/listinfo/nginx</a>]]></description>
            <dc:creator>Piotr Karbowski</dc:creator>
            <category>Nginx</category>
            <pubDate>Mon, 18 Jun 2012 22:00:02 +0200</pubDate>
        </item>
    </channel>
</rss>
