I had an unusual situation on my Zabbix box this evening - processor usage jumped up unusually high shortly after 9:30pm - went from less than 1% to over 20%.
When I looked at the processes it was PostgreSQL hitting the CPU quite hard, specifically one of the ZABBIX server processes. I watched what it was doing using the pg_stat_activity view and it seemed to be running the same query over and over again.
This was the query - it would then run an UPDATE, then COMMIT, then do the above SELECT, then keep repeating itself. This had been going on for 2 hours.
I restarted the Zabbix server process and all is well - the processor usage is back below 1% again. Looking through the server log file, it seemed like it hit a deadlock in PostgreSQL which caused it to go into a spiral.
The same detail was logged in the PostgreSQL error log.
When I looked at the processes it was PostgreSQL hitting the CPU quite hard, specifically one of the ZABBIX server processes. I watched what it was doing using the pg_stat_activity view and it seemed to be running the same query over and over again.
select t.triggerid,i.itemid from triggers t,functions f,items i where t.triggerid=f.triggerid and f.itemid=i.itemid and t.s
tatus in (0) and t.value not in (2) and i.itemid in (25,26)
tatus in (0) and t.value not in (2) and i.itemid in (25,26)
I restarted the Zabbix server process and all is well - the processor usage is back below 1% again. Looking through the server log file, it seemed like it hit a deadlock in PostgreSQL which caused it to go into a spiral.
18761:20091221:212937.423 [Z3005] Query failed: [0] PGRES_FATAL_ERROR:ERROR: deadlock detected
DETAIL: Process 18762 waits for ShareLock on transaction 64356; blocked by process 882.
Process 882 waits for ShareLock on transaction 64359; blocked by process 18762.
HINT: See server log for query details.
[update items set status=3,lastclock=1261430976,error='Unsupported parameters' where itemid=25;
update items set status=3,lastclock=1261430976,error='Unsupported parameters' where itemid=26;
]
DETAIL: Process 18762 waits for ShareLock on transaction 64356; blocked by process 882.
Process 882 waits for ShareLock on transaction 64359; blocked by process 18762.
HINT: See server log for query details.
[update items set status=3,lastclock=1261430976,error='Unsupported parameters' where itemid=25;
update items set status=3,lastclock=1261430976,error='Unsupported parameters' where itemid=26;
]
Comment