DevHeads.net

Postings by nizamov

apache2 mod_rewrite memleak

Hello,

We detect memleak in apache2 with mod_rewrite

steps for repeat:

create directory structure
.
└── categories
└── test
└── .htaccess

cat ./categories/.htaccess

RewriteEngine On
RewriteBase /categories/
RewriteRule "^(.*)\ (.*)$" "$1-$2" [R=301,N,QSA]

after it sent request to apache
curl -H "Host: example.com"
<a href="http://127.0.0.1/categories/test/%3C/a%20href=" title="http://127.0.0.1/categories/test/%3C/a%20href=">http://127.0.0.1/categories/test/%3C/a%20href=</a>

apache eating all memory and we got this in strace output
lstat("/var/www/html/example.com/categories/test",
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/var/www/html/example.com/categories/test/.htaccess",