[nginx] map module cause core dump

Maxim Dounin mdounin at mdounin.ru
Thu May 19 11:27:01 UTC 2016


On Thu, May 19, 2016 at 01:03:14PM +0800, 洪志道 wrote:

> Hi,
> It seems the following configure will cause core dump file.
> map $uri $s {
>     default  $s;  # same var name as the var generated by map directive
> above
> }
> server {
>     listen  80;
>     location / {
>         return 200 $s;
>     }
> }

This is a classical example of infinite recursion.  It's expected 
to work fine on any host with infinite amount of memory, but 
you've probably tried it on a host with some limited amount of 
memory available.  Avoid writing such configurations on hosts with 
limited amount of memory.

Jokes aside, the result is expected.  We've considered adding a 
protection from such types of recursion (much like what we do with 
subrequests and internal redirections), but yet think it would be 
an overkill.

Maxim Dounin

More information about the nginx-devel mailing list