high cpu usage with modsecurity 2.8.0 and nginx 1.6.2
Hello,
We're seeing high CPU usage when downloading large files with modsecurity enabled. Our setup has an nginx frontend with modsecurity backed by another nginx that is serving static files and fowarding requests to uwsgi. When I request a large file (100+MB), there is a several-second pause and the nginx with modsec starts chewing CPU and allocating a bunch of memory. When it is in this state and I attach with gdb, it is always in the apr_brigade_cleanup call of the move_brigade_to_chain function. If I let it run, it will eventually start sending data and processing can continue, but the pause blocks all other transfers.
This behavior makes modsec unusable for us. I tried setting 'SecResponseBodyAccess off' but that didn't seem to have any effect. I took a quick look at the code, but it didn't look like anything in the nginx-specific code was looking for that flag (I was searching for calls to modsecIsResponseBodyAccessEnabled).
Hi. We have got the same problem on production environment. We experienced it with modsecurity 2.8.0, 2.9.0 and nginx 1.6.2. User started download report file with size about 800MG. Nginx ate 100% of CPU and did not work anymore, so only restart of nginx helped. SecResponseBodyAccess off flag didn't help either.
Hi... Same here! SecResponseBodyAccess off or even SecRuleEngine Off won't make any difference as soon as ModSecurityEnabled is On!!!
Hi @Roger-Man,
try the ModSecurity-nginx connector: http://www.github.com/SpiderLabs/ModSecurity-nginx
No longer a concern in libModSecurity. Marking it as won't fix for 2.x. Further information about libModSecurity available here: https://github.com/SpiderLabs/ModSecurity/tree/v3/master