[ZBX-4891] Zabbix Server memory leak Created: 2012 Apr 19  Updated: 2017 May 30  Resolved: 2012 Oct 12

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 2.0.0rc3
Fix Version/s: 2.0.3

Type: Incident report Priority: Blocker
Reporter: Andrew Howell Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

RHEL 6.2


Attachments: Text File zabbix-valgrind.txt     File zabbix_server.conf     JPEG File zabbix_server_mysql memory usage.jpg     PNG File zbx-4891-memory-graph.PNG    

 Description   

Since upgrading to 2.0.0rc3 build 26725 from 2.0.0rc2 the server processes have had a memory leak. Seems to be about 350 K a minute according to my memory graphs.



 Comments   
Comment by Oleksii Zagorskyi [ 2012 Apr 21 ]

Andrew, describe please how do you monitor that "memory leak"?
Which is item key, or maybe some script?

Attach please the graph with maximal period where it's visible point of upgrade to 2.0.0rc3

Show us please result of this query:
SELECT i.type, COUNT AS count, SUM(1.0 / i.delay) AS qps
FROM items i, hosts h
WHERE i.hostid = h.hostid
AND i.status = 0
AND h.status = 0
AND i.delay <> 0
GROUP BY i.type

Comment by Andrew Howell [ 2012 Apr 23 ]

Hi Oleksiy,

Just noticed it with vm.memory.size[available] on the zabbix server. I've attached the graph, the date we upgraded to 2.0.0rc2 was the 12/4

You can see the memory usage conincedes with the restarts of the zabbix server (extract below from log file)

27430:20120412:083114.107 Starting Zabbix Server. Zabbix 2.0.0rc3 (revision 26725).
27430:20120416:160746.769 Zabbix Server stopped. Zabbix 2.0.0rc3 (revision 26725).
23294:20120416:160747.609 Starting Zabbix Server. Zabbix 2.0.0rc3 (revision 26725).
23294:20120417:084331.032 Zabbix Server stopped. Zabbix 2.0.0rc3 (revision 26725).
22622:20120417:084332.503 Starting Zabbix Server. Zabbix 2.0.0rc3 (revision 26725).
22622:20120417:151818.423 Zabbix Server stopped. Zabbix 2.0.0rc3 (revision 26725).
2723:20120417:152428.661 Starting Zabbix Server. Zabbix 2.0.0rc3 (revision 26725).
2723:20120419:163353.529 Zabbix Server stopped. Zabbix 2.0.0rc3 (revision 26725).
32681:20120419:163354.545 Starting Zabbix Server. Zabbix 2.0.0rc3 (revision 26725).
32681:20120420:145445.847 Zabbix Server stopped. Zabbix 2.0.0rc3 (revision 26725).
25211:20120420:145446.784 Starting Zabbix Server. Zabbix 2.0.0rc3 (revision 26980).
25591:20120420:150318.664 Starting Zabbix Server. Zabbix 2.0.0rc3 (revision 26980).

mysql> select i.type, COUNT as count, SUM(1.0 / i.delay) as qps from items i, hosts h where i.hostid = h.hostid and i.status = 0 and h.status = 0 and i.delay <> 0 group by i.type;
--------------------

type count qps

--------------------

0 21536 600.02947
1 245 4.00360
2 312 1.25926
3 12 0.34998
4 275 2.85220
5 234 7.28772
6 665 9.36384
8 8 0.13336
9 27 0.45009
10 9 0.00252

--------------------
10 rows in set (0.20 sec)

current zabbix processes

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
zabbix 25264 0.0 0.0 75008 496 ? S Apr20 0:00 /usr/sbin/zabbix_agentd
zabbix 25265 0.0 0.0 75008 584 ? S Apr20 1:02 /usr/sbin/zabbix_agentd
zabbix 25266 0.0 0.0 75232 1024 ? S Apr20 1:40 /usr/sbin/zabbix_agentd
zabbix 25267 0.0 0.0 75232 1024 ? S Apr20 1:37 /usr/sbin/zabbix_agentd
zabbix 25268 0.0 0.0 75232 1024 ? S Apr20 1:41 /usr/sbin/zabbix_agentd
zabbix 25591 0.0 0.0 159724 1276 ? S Apr20 0:00 zabbix_server_mysql
zabbix 25593 0.0 0.4 159468 10168 ? S Apr20 3:40 zabbix_server_mysql
zabbix 25594 0.0 0.0 159724 920 ? S Apr20 0:00 zabbix_server_mysql
zabbix 25595 3.2 1.3 273508 27476 ? S Apr20 127:50 zabbix_server_mysql
zabbix 25596 3.2 1.3 273600 27504 ? S Apr20 127:42 zabbix_server_mysql
zabbix 25597 3.2 1.3 273532 27608 ? S Apr20 127:45 zabbix_server_mysql
zabbix 25598 3.2 1.3 273596 27532 ? S Apr20 127:50 zabbix_server_mysql
zabbix 25599 3.2 1.3 273540 27540 ? S Apr20 127:20 zabbix_server_mysql
zabbix 25600 0.0 0.7 259456 15168 ? S Apr20 0:01 zabbix_server_mysql
zabbix 25601 0.0 0.9 161400 18524 ? S Apr20 3:01 zabbix_server_mysql
zabbix 25602 0.0 1.0 165344 22048 ? S Apr20 2:53 zabbix_server_mysql
zabbix 25603 0.0 0.9 161604 18596 ? S Apr20 2:41 zabbix_server_mysql
zabbix 25604 0.0 1.0 164356 21272 ? S Apr20 2:49 zabbix_server_mysql
zabbix 25605 0.0 0.8 161496 18172 ? S Apr20 2:06 zabbix_server_mysql
zabbix 25606 0.0 0.0 160304 828 ? S Apr20 0:00 zabbix_server_mysql
zabbix 25607 0.0 0.0 159724 1000 ? S Apr20 0:00 zabbix_server_mysql
zabbix 25608 0.0 0.1 161316 2932 ? S Apr20 1:39 zabbix_server_mysql
zabbix 25609 0.0 0.0 159724 884 ? S Apr20 0:00 zabbix_server_mysql
zabbix 25610 0.0 0.5 169528 11940 ? S Apr20 0:17 zabbix_server_mysql
zabbix 25611 0.0 0.0 259072 1192 ? S Apr20 0:00 zabbix_server_mysql
zabbix 25612 0.1 14.2 602456 291876 ? S Apr20 5:34 zabbix_server_mysql
zabbix 25613 0.1 11.6 546656 239492 ? S Apr20 4:53 zabbix_server_mysql
zabbix 25614 0.1 11.6 546352 238968 ? S Apr20 4:51 zabbix_server_mysql
zabbix 25615 0.3 29.5 1240812 605700 ? S Apr20 13:24 zabbix_server_mysql
zabbix 25616 0.0 0.0 159724 1096 ? S Apr20 0:03 zabbix_server_mysql
zabbix 25617 0.0 0.0 159820 836 ? S Apr20 0:00 zabbix_server_mysql
zabbix 25618 0.0 0.0 159724 796 ? S Apr20 0:00 zabbix_server_mysql
zabbix 25619 0.0 0.0 159724 824 ? S Apr20 0:00 zabbix_server_mysql
zabbix 25620 0.0 0.0 159724 556 ? S Apr20 0:00 zabbix_server_mysql

Comment by Andrew Howell [ 2012 Apr 23 ]

I upgraded to 2.0.0rc3 release today and early indications are that the memory leak is gone. I'll update you again tomorrow after it's been running over night

Comment by Andrew Howell [ 2012 Apr 24 ]

No the memory leak is still there (2.0.0rc3 rev 26994)

Comment by Andrew Howell [ 2012 Apr 30 ]

I still have this issue, can you explain why this ticket was closed? Please let me know if you want me to provide more information

Comment by Andrew Howell [ 2012 May 01 ]

Hi,

Could you please reopen this ticket and investigate it. I've attached valgrind log, happy to do run anything else you want me too.

Comment by Andrew Howell [ 2012 May 17 ]

Memory leak is still there in 2.0.0rc4

Comment by richlv [ 2012 May 17 ]

could you please monitor server memory usage with item key proc.mem[zabbix_server_mysql] ?
would be great to monitor after a server restart

Comment by Andrew Howell [ 2012 May 18 ]

Attached screenshot of proc.mem[zabbix_server_mysql] for a day. The drop at the beginning is where I restarted zabbix server

Comment by richlv [ 2012 May 18 ]

could you please attach zabbix server config file (w/o passwords etc) ?
also, what happens if you leave server running for a longer period of time, does memory usage growth stop eventually or does it continue (like several days w/o restarts) ?

Comment by Andrew Howell [ 2012 May 19 ]

Attached zabbix_server.conf. If you don't restart the server regularly the memory leak will grow until the server runs out of memory and swap.

Comment by Jeremy Lingmann [ 2012 Aug 27 ]

We are also experiencing this issue with Zabbix 2.0.2. The 'zabbix_server' process slowly grows in size, until we have to restart zabbix. Let me know if you would like us to collect any diagnostics information.

Comment by richlv [ 2012 Aug 27 ]

a memleak for 2.0 was fixed in ZBX-5435
those interested could try svn head or nightly snapshots

Comment by Benjamin [ 2012 Aug 28 ]

We are also experiencing this issue. Is the only fix to recompile from the most recent svn?

Comment by richlv [ 2012 Aug 28 ]

if it's thee same memleak, it might be a fix. if it's something else, of course, it won't help.

well, technically not using any triggers might also stop the leaks, but i wouldn't consider that to be a fix

Comment by Andrew Howell [ 2012 Oct 12 ]

This is fixed in 2.0.3

Generated at Tue Jun 17 07:58:43 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.