ModSecurity-nginx icon indicating copy to clipboard operation
ModSecurity-nginx copied to clipboard

feature request: hook memory in modsecurity

Open liudongmiao opened this issue 3 years ago • 3 comments

After hook glibc, there are some clear memory leak in modsecurity transaction.

There are pcre_malloc and pcre_free in this module, so I hook all memory callback in msc_transaction, and finally resolve the memory leak in modsecurity transaction.

(I have implemented, however, I won't add a PR without discussion.)

liudongmiao avatar Apr 01 '22 15:04 liudongmiao

And in our test, the performance (rps) increase about 3% - 15%.

liudongmiao avatar Apr 13 '22 22:04 liudongmiao

发个pr给我们测试下吧

zxyqq avatar Jun 29 '22 09:06 zxyqq

@zxyqq I use it to resolve memory issues. And if you use Persistent Storage (https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-(v3.x)#Persistent_Storage), it may won't work, as all memory would be free when transaction complete.

However, as expirevar is not implemented (https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-(v3.x)#expirevar), it would be ok. And I have use this patch found a transaction-related memory leak: https://github.com/SpiderLabs/ModSecurity/pull/2727

liudongmiao avatar Jun 30 '22 05:06 liudongmiao