[ZBX-24040] Zabbix agent 2 MongoDB plugin memory leak Created: 2024 Feb 05  Updated: 2024 Jul 01  Resolved: 2024 Jul 01

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent2 plugin (G)
Affects Version/s: 6.0.25, 7.0.0beta1
Fix Version/s: 6.0.32rc1, 6.4.17rc1, 7.0.1rc1, 7.2.0alpha1

Type: Problem report Priority: Trivial
Reporter: Kaspars Mednis Assignee: Eriks Sneiders
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2024-02-05-15-34-53-715.png     PNG File image-2024-05-07-10-09-22-385.png     PNG File screenshot-1.png    
Team: Team INT
Story Points: 2

 Description   

Steps to reproduce:

  1. Install Zabbix agent 2.
  2. Monitor MongoDB using the official "MongoDB node by Zabbix agent 2" template.
  3. Watch memory usage by Agent 2 plugin.

Result:
See screenshot...

See log files:

syslog:

Feb  3 08:32:05 training kernel: oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=rsyslog.service,mems_allowed=0,global_oom,task_memcg=/machine.slice/libpod-10f16718a3a2ee3ef19cbf8e3366bb5b7f1fea3960a12c18b2e05aa5f4c051b5.scope/container,task=zabbix-agent2-p,pid=1916759,uid=1997
Feb  3 08:32:05 training kernel: Out of memory: Killed process 1916759 (zabbix-agent2-p) total-vm:4691796kB, anon-rss:919544kB, file-rss:128kB, shmem-rss:0kB, UID:1997 pgtables:6932kB oom_score_adj:0
Feb  3 08:32:05 training zabbix-agent2[1916279]: 2024/02/03 08:32:05.392626 detected 183 time difference between queue checks, rescheduling tasks
Feb  3 08:32:05 training zabbix-agent2[1916279]: 2024/02/03 08:32:05.756539 failed to process an incoming connection from 10.89.0.1: Cannot read message: 'read tcp 10.89.0.84:10050->10.89.0.1:54106: i/o timeout'
Feb  3 08:32:06 training zabbix-server[1313561]:   269:20240203:083206.271 resuming JMX agent checks on host "Tomcat": connection restored
Feb  3 08:32:06 training zabbix-agent2[1916279]: 2024/02/03 08:32:06.683047 [101] cannot connect to [zabbix-server:10051]: dial tcp :0->10.89.0.74:10051: i/o timeout
Feb  3 08:32:06 training zabbix-agent2[1916279]: 2024/02/03 08:32:06.687183 [101] active check configuration update from host [Web server] started to fail
Feb  3 08:32:06 training kernel: oom_reaper: reaped process 1916759 (zabbix-agent2-p), now anon-rss:76kB, file-rss:0kB, shmem-rss:0kB
Feb  3 08:32:06 training zabbix-agent2[1916279]: panic: failed to write request for plugin MongoDB, write unix /tmp/agent.plugin.sock->@: write: broken pipe

Agent 2 crash log

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa827f0]
 
goroutine 1 [running]:
zabbix.com/plugins/external.(*Plugin).CheckPid(...)
        /tmp/zabbix-7.0/src/go/plugins/external/plugin.go:144
main.checkExternalExit(0x4532a6?, 0xc0001079ac?, {0xc000014d20?, 0x7fd49f20ab08?})
        /tmp/zabbix-7.0/src/go/cmd/zabbix_agent2/external_nix.go:78 +0x30
main.checkExternalExits()
        /tmp/zabbix-7.0/src/go/cmd/zabbix_agent2/external_nix.go:69 +0x135
main.handleSig({0xe8df48?, 0x1392908})
        /tmp/zabbix-7.0/src/go/cmd/zabbix_agent2/zabbix_agent2_nix.go:52 +0x99
main.run()
        /tmp/zabbix-7.0/src/go/cmd/zabbix_agent2/zabbix_agent2.go:787 +0x2a7
main.main()
        /tmp/zabbix-7.0/src/go/cmd/zabbix_agent2/zabbix_agent2.go:424 +0x126a

Expected:
Agent 2 mongodb plugin runs without consuming all available memory.



 Comments   
Comment by Eriks Sneiders [ 2024 Jun 20 ]

Fixed in

Generated at Wed Apr 09 15:34:18 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.