-
Notifications
You must be signed in to change notification settings - Fork 292
Memory management #79
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
Comments
I continued my investigations and did a little experiment. For clarity, I commented out all the handlers except
After this I did load testing (simple download request from the upstream, 1000 threads) and measured memory usage by the nginx before and after this. Here is the results.
After:
As you can see the memory usage increased significantly. After this I moved
And repeated the measurements. Here is the results.
After:
The memory usage increased not significantly. I can't explain this behaviour yet. |
@AirisX if you have any reasons to suspect possible memory leaks, why don't you use tools like valgrind/LSAN/ASAN for checking? What's the goal of measuring RSS? nginx uses pools [1] for memory allocations, as well as existing PCRE malloc/free handlers in current version of the connector module. Given the nature of pools, you may observe some spikes in memory usage during load testing. [1] http://nginx.org/en/docs/dev/development_guide.html#pool |
@defanator, such tools like Valgrind or ASAN don't detect any memory leaks in this case. But the fact is that memory usage by the worker process increases during load test and after some time isn't freed. |
I suppose that in case of invoking In case of invoking |
Hi @AirisX, The memory footprint used in current v3/master is way small that what was used back in 2017. I am closing this issue because I am assuming that it is no longer a problem. Please re-open in case you still have problems with the most recent code. |
Hi everyone,
it seems that memory manipulations like below are gives some memory leak:
https://github.com/SpiderLabs/ModSecurity-nginx/blob/a2a5858d249222938c2f5e48087a922c63d7f9d8/src/ngx_http_modsecurity_rewrite.c#L184-L186
I tried to comment out lines 184, 186 (except 185) and the difference between using memory by Nginx was more than 100 MB (less than before) after a little load test.
But in the following two cases, the same actions do not give the same result:
https://github.com/SpiderLabs/ModSecurity-nginx/blob/a2a5858d249222938c2f5e48087a922c63d7f9d8/src/ngx_http_modsecurity_rewrite.c#L86-L90
https://github.com/SpiderLabs/ModSecurity-nginx/blob/a2a5858d249222938c2f5e48087a922c63d7f9d8/src/ngx_http_modsecurity_rewrite.c#L135-L137
The text was updated successfully, but these errors were encountered: