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

Memory leak when using encryption by certificate in Zabbix Agent2.

XMLWordPrintable

    • Sprint 103 (Aug 2023)
    • 1

      Steps to reproduce:

      How to use zabbix.

      1. Enable encryption by certificate in Host settings.
      2. Memory usage will increase over time. 

      How to use the script.

      1. Clone zabbix repository. (git clone --depth 1 https://github.com/zabbix/zabbix.git && cd zabbix)
      2. Place the attached script.rb in the root directory of the repository. (cp <path to script.rb> .)
      3. Run script.rb. (ruby script.rb)

      Result:

      See screenshot for how to use zabbix.

      • The server restarts zabbix-agent2 every day around 6 am.

       

      See the log below for how to use the script.

      You can see that the memory usage increases with the number of calls made by zabbix_get.

      ************* Check for no pached *************
      ============ Check if TLS is not used. (1000 times) =============
      VmRSS:       17664 kB
      ============ Check if TLS is used. (1000 times) =============
      VmRSS:       32520 kB
      ============ Check if TLS is not used. (5000 times) =============
      VmRSS:       17608 kB
      ============ Check if TLS is used. (5000 times) =============
      VmRSS:       64480 kB
      
      patching file src/go/pkg/tls/tls.go
      ************* Check for pached *************
      ============ Check if TLS is not used. (1000 times) =============
      VmRSS:       17604 kB
      ============ Check if TLS is used. (1000 times) =============
      VmRSS:       24720 kB
      ============ Check if TLS is not used. (5000 times) =============
      VmRSS:       18204 kB
      ============ Check if TLS is used. (5000 times) =============
      VmRSS:       28520 kB
      

       

      Since tls_description is called from Client#String, the following commit seems to be the cause.

      This is why it has been occurring since version 6.0.19.

       

      https://github.com/zabbix/zabbix/commit/987c1827a6d5b9f5e3c3e2dfcaafe766b3a860b2

      https://github.com/zabbix/zabbix/commit/883caac8bd563c3d8706a725a687618e089ab25e

       
      Possibly related.
      https://support.zabbix.com/browse/ZBX-23076
      https://support.zabbix.com/browse/ZBX-23053
      https://support.zabbix.com/browse/ZBX-23047
       
      Expected:

      See patch.diff in the attached file.
       

        1. patch.diff
          0.4 kB
        2. script.rb
          3 kB
        3. script-2023-08-09.rb
          4 kB
        4. zabbix-agent2_memory-utilization.png
          zabbix-agent2_memory-utilization.png
          192 kB

            ak Andrejs Kozlovs
            masato hirahata Masato Hirahata
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: