[ZBX-13241] Memory leak when executing remote commands through proxy Created: 2017 Dec 21  Updated: 2024 Apr 10  Resolved: 2017 Dec 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 3.4.5rc3, 4.0.0alpha1
Fix Version/s: 3.4.6rc1, 4.0.0alpha2, 4.0 (plan)

Type: Problem report Priority: Critical
Reporter: Vladislavs Sokurenko Assignee: Vladislavs Sokurenko
Resolution: Fixed Votes: 0
Labels: memoryleak, remotecommands, trapper
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Causes
caused by ZBXNEXT-936 Zabbix Proxy does not proxy remote co... Closed
Team: Team A
Sprint: Sprint 23, Sprint 24
Story Points: 0.25

 Description   

After sending proxy data response JSON is cleaned instead of being freed

Index: src/zabbix_server/trapper/proxydata.c
===================================================================
--- src/zabbix_server/trapper/proxydata.c	(revision 76251)
+++ src/zabbix_server/trapper/proxydata.c	(working copy)
@@ -59,7 +59,7 @@
 			zbx_tm_update_task_status(&tasks, ZBX_TM_STATUS_INPROGRESS);
 	}
 
-	zbx_json_clean(&json);
+	zbx_json_free(&json);
 
 	zbx_vector_ptr_clear_ext(&tasks, (zbx_clean_func_t)zbx_tm_task_free);
 	zbx_vector_ptr_destroy(&tasks);
==13590== 131,072 bytes in 1 blocks are definitely lost in loss record 51 of 51
==13590==    at 0x4C2FB6B: malloc (vg_replace_malloc.c:299)
==13590==    by 0x567CDF: zbx_malloc2 (misc.c:491)
==13590==    by 0x59375D: __zbx_json_realloc (json.c:100)
==13590==    by 0x594AB3: zbx_json_addstring (json.c:325)
==13590==    by 0x6339EF: tm_json_serialize_remote_command (task.c:486)
==13590==    by 0x6339EF: zbx_tm_json_serialize_tasks (task.c:543)
==13590==    by 0x45E6CF: zbx_send_proxy_data_respose (proxydata.c:54)
==13590==    by 0x45E901: zbx_recv_proxy_data (proxydata.c:116)
==13590==    by 0x45BE03: process_trap (trapper.c:982)
==13590==    by 0x45D3A5: process_trapper_child (trapper.c:1118)
==13590==    by 0x45D3A5: trapper_thread (trapper.c:1168)
==13590==    by 0x55EB2C: zbx_thread_start (threads.c:128)
==13590==    by 0x43294B: MAIN_ZABBIX_ENTRY (server.c:1080)
==13590==    by 0x533BE6: daemon_start (daemon.c:392)
==13590== 
==13590== LEAK SUMMARY:
==13590==    definitely lost: 131,072 bytes in 1 blocks
==13590==    indirectly lost: 0 bytes in 0 blocks
==13590==      possibly lost: 0 bytes in 0 blocks
==13590==    still reachable: 169,516 bytes in 174 blocks
==13590==         suppressed: 0 bytes in 0 bloc


 Comments   
Comment by Vladislavs Sokurenko [ 2017 Dec 28 ]

Fixed in:

  • pre-3.4.6rc1 r76360
  • pre-4.0.0alpha2 (trunk) r76362
Generated at Fri Apr 26 03:56:48 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.