[ZBX-8299] Existence of discovery rule not checked when running discovery via proxy and the rule on server gets deleted while being run on proxy Created: 2014 Jun 04  Updated: 2017 May 30  Resolved: 2015 May 11

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 2.2.3
Fix Version/s: 2.0.15rc1, 2.2.10rc1, 2.4.6rc1, 2.5.0

Type: Incident report Priority: Blocker
Reporter: Ingus Vilnis Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: discoveryrule, networkdiscovery, proxy
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate

 Description   

Existence of discovery rule not checked when running discovery rule via proxy and if the rule on server gets deleted meanwhile being run on proxy.

How to reproduce:
1. Zabbix Server 2.2.3, Zabbix Proxy
2. Configuration -> Discovery -> Create discovery rule
3. Set the rule to be monitored via Proxy
4. Set IP range, delay, and select check type like "ICMP ping"
5. Wait for rule to run on proxy, check it in Monitoring -> Discovery
6. When some hosts start to appear, stop Zabbix server Server must be stopped before the discovery on proxy is finished
7. With the server stopped, delete the newly created discovery rule
8. Start Zabbix server

In this scenario Zabbix proxy does not check for existence of discovery rule after server restart and continues to send in discovery data to non-existing rule.
That makes Zabbix server log to show the following line repeatedly:

 18354:20140604:140732.946 [Z3005] query failed: [1452] Cannot add or update a child row: a foreign key constraint fails (`zabbix`.`dhosts`, CONSTRAINT `c_dhosts_1` FOREIGN KEY (`druleid`) REFERENCES `drules` (`druleid`) ON DELETE CASCADE) [insert into dhosts (dhostid,druleid) values (192,6)]


 Comments   
Comment by Oleksii Zagorskyi [ 2014 Jun 05 ]

I think it's absolutely real even in production (w/o stopping zabbix server).
For example discovery for a big network can take a lot of time and during discovery the rule being deleted on server.

added:
what if in my case discovery rules takes so much time that proxy is able to update its config cache from server?
Maybe SQL errors will appear (also?) on proxy side ?

Comment by Aleksandrs Saveljevs [ 2015 Apr 20 ]

Oleksiy is right: if we perform network discovery on the server and we delete a discovery rule while the discovery is running, the same error will occur.

Comment by Aleksandrs Saveljevs [ 2015 Apr 22 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-8299 by verifying that discovery rules and discovery checks exist in the database before performing any database operations.

Comment by Andris Zeila [ 2015 Apr 29 ]

Successfully tested

Comment by Aleksandrs Saveljevs [ 2015 Apr 29 ]

Fixed in pre-2.0.15 r53412, pre-2.2.10 r53413, pre-2.4.6 r53414, pre-2.5.0 (trunk) r53415.

Generated at Tue Apr 23 23:46:27 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.