Improper Agent2 shutdown if ModBus plugin is used

XMLWordPrintable

    • Sprint candidates

      Steps to reproduce:

      1. Install Agent2 with ModBus plugin support
      2. Make host with several Items that uses modbus.get key (See attachments)
      3. Perform command for each port used by modbus.get
      sudo iptables -A INPUT -p tcp --dport 1502 -j DROP
      

      This will make item to timeout

      1. Let this configuration run for sometime (10-15 minutes)
      2. Stop Agent2 (Ctrl+C)

      Result:
      SSH console response

      panic: runtime error: index out of range [1] with length 0 [recovered]
              panic: runtime error: index out of range [1] with length 0
      
      goroutine 8 [running]:
      golang.zabbix.com/sdk/log.PanicHook()
              /home/zabbix/work/pkg/mod/golang.zabbix.com/[email protected]/log/log.go:309 +0x214
      panic({0xe4f440?, 0xc000038cf0?})
              /home/zabbix/work/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:792 +0x132
      golang.zabbix.com/agent2/internal/agent/scheduler.pluginHeap.Less({0xc000010150?, 0xc000155a30?, 0x9000000004790b9?}, 0x1000101?, 0x0?)
              /home/zabbix/workspace/ZBX-27542-7.0/src/go/internal/agent/scheduler/pluginheap.go:29 +0xf7
      container/heap.up({0xfe27a0, 0xc000206a60}, 0x1?)
              /home/zabbix/work/pkg/mod/golang.org/[email protected]/src/container/heap/heap.go:92 +0x74
      container/heap.Fix({0xfe27a0, 0xc000206a60}, 0x1)
              /home/zabbix/work/pkg/mod/golang.org/[email protected]/src/container/heap/heap.go:85 +0x58
      golang.zabbix.com/agent2/internal/agent/scheduler.(*pluginHeap).Update(...)
              /home/zabbix/workspace/ZBX-27542-7.0/src/go/internal/agent/scheduler/pluginheap.go:75
      golang.zabbix.com/agent2/internal/agent/scheduler.(*Manager).processFinishRequest(0xc000206a50, {0xfe9bc0, 0xc0002626c0})
              /home/zabbix/workspace/ZBX-27542-7.0/src/go/internal/agent/scheduler/manager.go:509 +0x214
      golang.zabbix.com/agent2/internal/agent/scheduler.(*Manager).run(0xc000206a50)
              /home/zabbix/workspace/ZBX-27542-7.0/src/go/internal/agent/scheduler/manager.go:616 +0x874
      created by golang.zabbix.com/agent2/internal/agent/scheduler.(*Manager).Start in goroutine 1
              /home/zabbix/workspace/ZBX-27542-7.0/src/go/internal/agent/scheduler/manager.go:690 +0xa5
      
      

      2. If you start-stop Agent2 again - problem will not occur.
      If you let Agent2 run for sometime - it will appear again.

      Expected:
      Expected no panic or critical messages when stoping Agent2

            Assignee:
            Zabbix Integration Team
            Reporter:
            Vitalijs Cernisovs
            Team INT
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: