-
Notifications
You must be signed in to change notification settings - Fork 445
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 when using event broker #664
Comments
Thanks for reporting this! I'll try to look into this sometime this week. |
Okay, I had time to look at this. It looks like I've set up a branch at https://github.com/Madlohe/nagioscore/tree/bug-664/leaky-MG-check-results which seems to be working. Would you be willing to compile from there and verify that this fixes the issue for you? |
Sure, I will be testing it today. I will keep you posted. Thanks a lot! |
It appears to be working fine, the memory leak is gone! Thanks |
Excellent! Merging and closing now. |
Hi. I've found a memory in run_async_service_check and run_async_host_check, when using event brokers (in my case mod_gearman 3.10). If lots of checks per second are running, this can leak a couple of GBs per day.
nagioscore/base/checks.c
Lines 3186 to 3193 in a7346f7
The calloc'd variable "cr" (which contains the tentative check results) has its contents cleared but is never free'd.
When using mod-gearman, the memory for the check results is allocated when the results of a check are ready, and thus the memory allocated by Nagios itself will leak.
There is no way to free it on the NEB module without making the nagios process crash when it calls free_check_result, since the module can't set the cr variable to null (it will keep pointing to recently free'd memory).
Thanks, Gonzalo
The text was updated successfully, but these errors were encountered: