Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
[dev.icinga.com #3406] many ido2db memory leaks on dbi_result_free and others #1151
This issue has been migrated from Redmine: https://dev.icinga.com/issues/3406
Created by abraxas on 2012-10-29 01:44:45 +00:00
In our companies icinga installation we are facing memory leaks that also lead to high cpu load of the ido2db process. The result is an increased latency on icinga-core and a drop in checks performed per 5 minutes over time.
Last week we moved from postgresql to mysql database backend and faced the same problem, so I started a code review. I found several memory leaks in libdbi handling as well as general allocation/error handling issues.
The patch included in the bug report has been tested over the weekend and seems stable. Further testing is required to ensure stabliity of the code. The fix included does affect both postgresql and mysql handling though it has only been tested on mysql.
Formal findings (102 fixed leaks):
dbqueries.c: insert_or_update - result is not freed between insert and update
A part of this issue is covered in Bug #3405 (which has been reported today), however this patch fixed additional leaks so i reported as separate issue.
2012-10-29 18:31:20 +00:00 by mfriedrich 59bec47
2012-11-01 13:07:33 +00:00 by mfriedrich 5344f68
2012-11-01 13:33:01 +00:00 by mfriedrich f3df924
Updated by mfriedrich on 2012-10-29 18:25:02 +00:00
Updated by abraxas on 2012-10-30 15:10:02 +00:00
My patch missed the int x; declaration. Seems I fixed that after pulling the patch from local repo.
I want to add that today we switched back to postgresql backend and the memory usage is stable as well (albeit higher in total, but that could be libdbi/postgresql handling).
Looking forward to see this in next release.
Updated by mfriedrich on 2012-10-30 15:25:58 +00:00
afaik libdbi is built again 8.1 api of pgsql (the newer versions link against 8.4 iirc). on rhel5 i had the problem with the old libdbi packages, linking the old libpq api, leaking memory as well. see #2741 for the note.
regarding your patch - hopefully the kudos given are ok?
1.8.2 will be due once some core/classic ui issues are solved as well.
Updated by abraxas on 2012-10-31 09:03:10 +00:00
I have been looking into 2741 before I started to look in the code and we had a higher memory consumption when using 9.1 client libs then the RHEL based build on 8.4.
Now we stick to the OS bundled libraries (postgresql server version is 9.1 though) which have now been running for over a day without any raise in memory consumption. Looks good from our side, and yes kudos are appreciated :).