-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak/crash with v3/master #1411
Comments
Some additional info: The debug log (which also tells us the rule being evaluated) reads: Clearly, there are (possibly several) things going wrong here: This msg does not pertain to that particular rule at all. We have obviously deployed with configuration, otherwise this message would have appeared for every request. As @mhalden mentioned, the same rule is hit every time the situation occurs. Other rules (including (false) positives) hit all the time, so in general, rule processing seems to work. We're concatenating modsecurity.conf, crs-setup.conf and rules/*.conf (minus PHP, IIS, WORDPRESS and DRUPAL) into our local config, which is used globally in the nginx configuration. I'll also refer to issue #1406 (empty audit logs) - this is on the same build and the same systems. |
Another tidbit: We suspect that the same issue has occurred in 2.9.1; our first attempt at using ModSecurity was nginx with 2.9.1 as that is what the FreeBSD port of nginx originally supported. Soon after building and installing it, we saw nginx bombing out like described above (working fine for a little while, then upon certain requests - not sure which - started growing wildly). We did not dig further into this as we realised v3 is the future, and embarked upon making an updated nginx port and a standalone modsecurity port to support this. |
From ktrace output (time stamps are relative to the previous entry):
|
Please let me know the results while running without LMDB support. |
There haven't been any more core dumps since we updated, I believe. The "typical" traffic should start hitting right about now, so we'll know for certain in a few hours - but statistically it should have dumped at least 30 times during the night alone. Thanks! Now if we'd just have those pesky audit logs written to... |
So - it looks like clang 3.4.1 causes nginx to crash and burn with -O1 or higher. GCC 6.3 and clang 3.8.1 both produce binaries that seem to work fine even with the default -O3. Since FreeBSD 11 and above ships with clang 3.8, and 10.3 can use clang 3.8 from ports, the solution is to have the Makefile for the port pull in clang 3.8 if the OS version is <11. So, again we're back to the missing audit logs before ModSecurity becomes useful :) |
Aaaaand...scratch the part about clang. Even when built with 3.8.1 it crashes. We're now back to the GCC build, which we'll test more extensively. |
Any updates on this? Improvements with clang 4 (FreeBSD 11.1)? Fixes in the ModSecurity code? If this is not fixed, can this be re-opened or a new Issue created? |
The current port for nginx and mod_security3 work, but there are significant memory leaks on systems with heavy traffic. We're using cron to call 'nginx -s reload' every few hours to circumvent this, but we have not been able to determine to cause for the leaks yet. Using CRS 3.0 ruleset with some whitelisting. |
right, so since there isn't a crash any longer and the leak apparently is not the same, better to create a new issue just to keep the issue easy to read. @ltning can you create a new issue to summarize the leak that you are facing? make sure to mention libModSecurity version. Also, make sure that LMDB is not enabled. Thank you! |
Hi All Can help to confirm the issue still exist or not possible? History... So I tried to remove it and rebuild use FreeBSD build-in LLVM/Clang 10 I realize GCC for this issue. Thanks a lot. |
@Neko-Chang-Taiwan apache connector for ModSecurity v3 is still not ready. |
Hi @zimmerle Because log as below |
It is not ready for production yet. For Apache, we suggest our users to keep using the stable version: 2.9.3 |
We are observing a memory leak with modsecurity v3 0e05b7b and 6421ff0 on FreeBSD 10.3 with nginx 1.12.0. After running for a few minutes it will allocate about 32GiB of memory (it seems to always allocate the same amount) and will shortly after use all the memory before it dies of SIGSEGV. From what we can gather it always dies evaluating the same rule, although the rule has been evaluated successfully earlier before this happens.
We have the following stack trace from the coredump.
The text was updated successfully, but these errors were encountered: