alerta / nagios-alerta

Forward nagios alerts to the alerta monitoring system
http://alerta.io
MIT License
23 stars 15 forks source link

Code commit much memory and can't free it #19

Closed maxiGF closed 7 years ago

maxiGF commented 7 years ago

Hi, The past week we installed it on check-mk server. The integration works fine but every 24 hours the service was going down. When we were saw the graphics, we saw that the aplication commit on progresive mode memory but doen't free it Can you help us?

satterly commented 7 years ago

Running valgrind highlights a few issues that should probably be addressed...


root@ubuntu-xenial:~/nagios-alerta# valgrind --tool=memcheck --leak-check=yes /usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg
==7475== Memcheck, a memory error detector
==7475== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==7475== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==7475== Command: /usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg
==7475==

Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL

Website: https://www.nagios.org
Nagios 4.1.1 starting... (PID=7475)
Local time is Tue Aug 22 08:01:24 UTC 2017
nerd: Channel hostchecks registered successfully
nerd: Channel servicechecks registered successfully
nerd: Channel opathchecks registered successfully
nerd: Fully initialized and ready to rock!
wproc: Successfully registered manager as @wproc with query handler
wproc: Registry request: name=Core Worker 7476;pid=7476
wproc: Registry request: name=Core Worker 7477;pid=7477
wproc: Registry request: name=Core Worker 7479;pid=7479
wproc: Registry request: name=Core Worker 7478;pid=7478
Event broker module '/usr/lib/nagios/alerta-neb.o' initialized successfully.
Successfully launched command file worker with pid 7480
==7475== Process terminating with default action of signal 2 (SIGINT)
==7475==    at 0x544E9D3: ??? (syscall-template.S:84)
==7475==    by 0x472963: iobroker_poll (in /usr/local/nagios/bin/nagios)
==7475==    by 0x4317AF: event_execution_loop (in /usr/local/nagios/bin/nagios)
==7475==    by 0x413A31: main (in /usr/local/nagios/bin/nagios)
==7475==
==7475== HEAP SUMMARY:
==7475==     in use at exit: 5,288,165 bytes in 4,726 blocks
==7475==   total heap usage: 15,174 allocs, 10,448 frees, 6,304,641 bytes allocated
==7475==
==7475== 47 (16 direct, 31 indirect) bytes in 1 blocks are definitely lost in loss record 856 of 1,033
==7475==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7475==    by 0x69974B9: ??? (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0)
==7475==    by 0x6997527: curl_slist_append (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0)
==7475==    by 0x6752A11: send_to_alerta (alerta-neb.c:235)
==7475==    by 0x6752D7D: check_handler (alerta-neb.c:451)
==7475==    by 0x4169FE: neb_make_callbacks (in /usr/local/nagios/bin/nagios)
==7475==    by 0x414E93: broker_service_check (in /usr/local/nagios/bin/nagios)
==7475==    by 0x42018A: handle_async_service_check_result (in /usr/local/nagios/bin/nagios)
==7475==    by 0x41A729: ??? (in /usr/local/nagios/bin/nagios)
==7475==    by 0x4729B0: iobroker_poll (in /usr/local/nagios/bin/nagios)
==7475==    by 0x4317AF: event_execution_loop (in /usr/local/nagios/bin/nagios)
==7475==    by 0x413A31: main (in /usr/local/nagios/bin/nagios)
==7475==
==7475== 47 (16 direct, 31 indirect) bytes in 1 blocks are definitely lost in loss record 857 of 1,033
==7475==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7475==    by 0x69974B9: ??? (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0)
==7475==    by 0x6997527: curl_slist_append (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0)
==7475==    by 0x6752A11: send_to_alerta (alerta-neb.c:235)
==7475==    by 0x675377E: check_handler (alerta-neb.c:512)
==7475==    by 0x4169FE: neb_make_callbacks (in /usr/local/nagios/bin/nagios)
==7475==    by 0x414E93: broker_service_check (in /usr/local/nagios/bin/nagios)
==7475==    by 0x42018A: handle_async_service_check_result (in /usr/local/nagios/bin/nagios)
==7475==    by 0x41A729: ??? (in /usr/local/nagios/bin/nagios)
==7475==    by 0x4729B0: iobroker_poll (in /usr/local/nagios/bin/nagios)
==7475==    by 0x4317AF: event_execution_loop (in /usr/local/nagios/bin/nagios)
==7475==    by 0x413A31: main (in /usr/local/nagios/bin/nagios)
==7475==
==7475== 75 bytes in 1 blocks are definitely lost in loss record 883 of 1,033
==7475==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7475==    by 0x67528BE: replace_char (alerta-neb.c:169)
==7475==    by 0x67529F8: send_to_alerta (alerta-neb.c:230)
==7475==    by 0x6752D7D: check_handler (alerta-neb.c:451)
==7475==    by 0x4169FE: neb_make_callbacks (in /usr/local/nagios/bin/nagios)
==7475==    by 0x414E93: broker_service_check (in /usr/local/nagios/bin/nagios)
==7475==    by 0x42018A: handle_async_service_check_result (in /usr/local/nagios/bin/nagios)
==7475==    by 0x41A729: ??? (in /usr/local/nagios/bin/nagios)
==7475==    by 0x4729B0: iobroker_poll (in /usr/local/nagios/bin/nagios)
==7475==    by 0x4317AF: event_execution_loop (in /usr/local/nagios/bin/nagios)
==7475==    by 0x413A31: main (in /usr/local/nagios/bin/nagios)
==7475==
==7475== 340 bytes in 1 blocks are definitely lost in loss record 948 of 1,033
==7475==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7475==    by 0x67528BE: replace_char (alerta-neb.c:169)
==7475==    by 0x67529F8: send_to_alerta (alerta-neb.c:230)
==7475==    by 0x675377E: check_handler (alerta-neb.c:512)
==7475==    by 0x4169FE: neb_make_callbacks (in /usr/local/nagios/bin/nagios)
==7475==    by 0x414E93: broker_service_check (in /usr/local/nagios/bin/nagios)
==7475==    by 0x42018A: handle_async_service_check_result (in /usr/local/nagios/bin/nagios)
==7475==    by 0x41A729: ??? (in /usr/local/nagios/bin/nagios)
==7475==    by 0x4729B0: iobroker_poll (in /usr/local/nagios/bin/nagios)
==7475==    by 0x4317AF: event_execution_loop (in /usr/local/nagios/bin/nagios)
==7475==    by 0x413A31: main (in /usr/local/nagios/bin/nagios)
==7475==
==7475== LEAK SUMMARY:
==7475==    definitely lost: 447 bytes in 4 blocks
==7475==    indirectly lost: 62 bytes in 2 blocks
==7475==      possibly lost: 0 bytes in 0 blocks
==7475==    still reachable: 5,287,656 bytes in 4,720 blocks
==7475==         suppressed: 0 bytes in 0 blocks
==7475== Reachable blocks (those to which a pointer was found) are not shown.
==7475== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==7475==
==7475== For counts of detected and suppressed errors, rerun with: -v
==7475== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
==7475== could not unlink /tmp/vgdb-pipe-from-vgdb-to-7475-by-root-on-???
==7475== could not unlink /tmp/vgdb-pipe-to-vgdb-from-7475-by-root-on-???
==7475== could not unlink /tmp/vgdb-pipe-shared-mem-vgdb-7475-by-root-on-???

root@ubuntu-xenial:/etc/init.d# ==7480==
==7480== HEAP SUMMARY:
==7480==     in use at exit: 4,595,902 bytes in 3,459 blocks
==7480==   total heap usage: 14,734 allocs, 11,275 frees, 5,456,600 bytes allocated
==7480==
==7480== LEAK SUMMARY:
==7480==    definitely lost: 0 bytes in 0 blocks
==7480==    indirectly lost: 0 bytes in 0 blocks
==7480==      possibly lost: 0 bytes in 0 blocks
==7480==    still reachable: 4,595,902 bytes in 3,459 blocks
==7480==         suppressed: 0 bytes in 0 blocks
==7480== Reachable blocks (those to which a pointer was found) are not shown.
==7480== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==7480==
==7480== For counts of detected and suppressed errors, rerun with: -v
==7480== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
``
satterly commented 7 years ago

Please test and let me know if the problem has been fixed in version 3.4.2. Thanks.