[ZBX-16270] Memory leak in IPC service when queueing multiple messages to client Created: 2019 Jun 17  Updated: 2024 Apr 10  Resolved: 2019 Jul 04

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 4.0.9
Fix Version/s: 4.0.11rc1, 4.2.5rc1, 4.4.0alpha1, 4.4 (plan)

Type: Problem report Priority: Minor
Reporter: Andris Zeila Assignee: Andrejs Kozlovs
Resolution: Fixed Votes: 0
Labels: memoryleak
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Team: Team A
Sprint: Sprint 53 (Jun 2019), Sprint 54 (Jul 2019)
Story Points: 0.5

 Description   

When mutiple messages are queued to be sent to clients either by service or by asynchronous socket, the message container is not freed after next message is popped from the send queue:

diff --git a/src/libs/zbxipcservice/ipcservice.c b/src/libs/zbxipcservice/ipcservice.c
index 5b7cd179fc..bce29b4fd9 100644
--- a/src/libs/zbxipcservice/ipcservice.c
+++ b/src/libs/zbxipcservice/ipcservice.c
@@ -613,6 +613,7 @@ static void ipc_client_pop_tx_message(zbx_ipc_client_t *client)
        client->tx_header[ZBX_IPC_MESSAGE_CODE] = message->code;
        client->tx_header[ZBX_IPC_MESSAGE_SIZE] = message->size;
        client->tx_data = message->data;
+       zbx_free(message);
 }
 
 /******************************************************************************

However currently this leak is theoretical, as service uses strictly request/response pattern when communicating with clients and the same pattern is used when async socket is used by external clients to communicate with a service.



 Comments   
Comment by Andrejs Kozlovs [ 2019 Jul 02 ]

Fixed in:

  • 4.0.11rc1 98bc5ae8e05
  • 4.2.5rc1 ae54fb6c1a7
  • 4.4.0alpha1 (master) c9ef348795c
Generated at Fri Apr 26 13:06:00 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.