Skip to content

Conversation

AriaJamili
Copy link

The error is caused in the file “src/libs/zbxdbwrap/host.c”. Specifically, during housekeeping, when an item is deleted, the corresponding trigger entry is also removed from the database. However, it can happen that no corresponding trigger is found, which then causes the bug, as Zabbix attempts to execute an empty begin; end statement.

246123:20250624:140210.698 In DBdelete_triggers_by_itemids() values_num:48
246123:20250624:140210.698 query [txnlev:1] [select distinct f.triggerid,t.description,t.flags from functions f join triggers t on t.triggerid=f.triggerid where (itemid between 65311 and 65316 or itemid between 65323 and 65328 or itemid
in (65037,65043,65048,65052,65057,65062,65066,65071,65074,65078,65082,65086,65090,65094,65305,65306,65307,65308,65318,65319,65330,65331,65335,65336,65338,65339,65341,65342,65344,65345,65347,65348,65350,65351,65353,65354))]
246123:20250624:140210.708 In DBdelete_trigger_hierarchy()
246123:20250624:140210.708 query [txnlev:1] [select distinct td.triggerid,t.description,t.flags from trigger_discovery td, triggers t where td.triggerid=t.triggerid and parent_triggerid in (25964,25979,25980)]
246123:20250624:140210.716 query [txnlev:1] [select distinct selementid from sysmap_element_trigger where triggerid in (25964,25979,25980)]
246123:20250624:140210.717 query [txnlev:1] [update conditions set value='0' where conditiontype=2 and value in ('25964','25979','25980')]
246123:20250624:140210.721 query [txnlev:1] [delete from trigger_tag where triggerid in (25964,25979,25980)]
246123:20250624:140210.722 query [txnlev:1] [delete from functions where triggerid in (25964,25979,25980)]
246123:20250624:140210.724 query [txnlev:1] [delete from triggers where triggerid in (25964,25979,25980)]
246123:20250624:140210.726 query [txnlev:1] [begin.end;]
246123:20250624:140210.728 [Z3008] query failed due to primary key constraint: [-1] ORA-06550: line 2, column 1:
PLS-00103: Encountered the symbol "END" when expecting one of the following:

( begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
continue close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe purge
json_exists json_value json_query json_object json_array
246123:20250624:140210.728 query [begin.end;] failed, setting transaction as failed

The fix is to check the length of the statement before executing the SQL statement. Since this solution is also implemented in other places in host.c, I tried it analogously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant