Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-23417

Memory leak in agent when checking modbus.get[] item

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • 6.0.22rc1, 6.4.7rc1, 7.0 (plan)
    • 6.0.22rc1, 6.4.7rc1
    • Agent (G)
    • None
    • Unix
    • Sprint 104 (Sep 2023)
    • 1

      Steps to reproduce:
      Try to check modbus.get[] from a machine without modbus support (connection will be refused):

      $ valgrind -v --tool=memcheck --leak-check=full --trace-children=yes --track-origins=yes --time-stamp=yes --max-stackframe=4435592 --log-file=/tmp/zabbix_agentd_%p --leak-resolution=high --show-leak-kinds=all zabbix_agentd -t modbus.get[tcp://127.0.0.1]
      

      Result:
      Valgrind shows memory leak:

      ==00:00:00:00.598 42628== 1,024 bytes in 1 blocks are definitely lost in loss record 11 of 12
      ==00:00:00:00.598 42628==    at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==00:00:00:00.598 42628==    by 0x16F20A: zbx_malloc2 (misc.c:152)
      ==00:00:00:00.598 42628==    by 0x1700F4: zbx_dvsprintf (common_str.c:72)
      ==00:00:00:00.598 42628==    by 0x170206: zbx_dsprintf (common_str.c:111)
      ==00:00:00:00.598 42628==    by 0x145396: modbus_read_data (modbus.c:552)
      ==00:00:00:00.598 42628==    by 0x145396: modbus_get (modbus.c:820)
      ==00:00:00:00.598 42628==    by 0x132948: zbx_execute_agent_check (sysinfo.c:1228)
      ==00:00:00:00.598 42628==    by 0x132DAB: zbx_test_parameter (sysinfo.c:970)
      ==00:00:00:00.598 42628==    by 0x11F4E2: main (zabbix_agentd.c:1545)
      

      Expected:
      No memory leak.

            andris Andris Mednis
            andris Andris Mednis
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: