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

Zabbix_sender (6.0.0~6.0.2) exits w/o releasing semaphore on FreeBSD 13.0 etc.

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • 6.0.4rc1, 6.2.0alpha1, 6.2 (plan)
    • 6.0.1, 6.0.2
    • Agent (G)
    • FreeBSD 13.0 Release p7
      Gentoo Linux (Kernel:5.15.26-gentoo-x86_64)
    • Team A
    • Sprint 86 (Mar 2022), Sprint 87 (Apr 2022)
    • 0.25

      Steps to reproduce:

      1. Install zabbix_sender with Ports or pkg on FreeBSD or emerge on Gentoo Linux.
      2. Use the same configuration(zabbix_agentd.conf or zabbix_agent2.conf) with no problem on Zabbix 5.4.11.
      3. Execute "ipcs -s" before executing zabbix_sender command below.
      4. Execute "zabbix_sender -c ... -k test -o 1", where it is ok that key and value are random one. 
      5. Execute "ipcs -s" after executing zabbix_sender command above.
      6. Not released semaphore owned by root is added. 

      Zabbix_sender in Zabbix 6 exits without releasing the semaphore it used on my FreeBSD 13.0 system.
      Zabbix_sender in Zabbix 5.4.11 or below exits normally after releasing the semaphore it used.

      I experienced the same situation on my Gentoo Linux system too.

      But, zabbix_sender in Zabbix 6 exit with no problem on my Fedora 35, Ubuntu 20.04, Debian 11 or Arch Linux system.

      I found the Asymmetric usage of zbx_locks_* in zabbix_sender.c.

      • Initializing locks uses zbx_locks_create(&error) #ifndef _WINDOWS on l.1508 and l.1509
      • Finalizing locks uses zbx_locks_disable() #if !defined(_WINDOWS) && defined(HAVE_PTHREAD_PROCESS_SHARED) on l.1868 and l.1869

      HAVE_PTHREAD_PROCESS_SHARED appears only at finalizing, and zabbix_sender.c uses zabbix_locks_create() and zabbix_locks_disable().

      In mutex.h, zbx_locks_enable() seems to be paired with zbx_locks_disable(), and zbx_locks_create() seems to be paired with zbx_locks_destroy().

      So, I changed the zabbix_sender.c like the appended patch, and patched zabbix_sender just exits normally after releasing the semaphore it used
      on my both FreeBSD 13.0 and  Gentoo Linux systems.

       

            vso Vladislavs Sokurenko
            Tomohide Tomohide Yamamoto
            Team A
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: