[ZBX-7445] Frontend tries to take latest values while deleting host Created: 2013 Nov 27  Updated: 2017 May 30  Resolved: 2013 Dec 04

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 2.2.1rc1
Fix Version/s: 2.2.2rc1, 2.3.0

Type: Incident report Priority: Major
Reporter: Alexey Pustovalov Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: optimization
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Steps to reproduce:
1. Host with template: Template App Zabbix Server, Template OS Linux (Template App Zabbix Agent)
2. Queries like:
SQL (0.003269): (SELECT * FROM history h WHERE h.itemid='23252' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23253' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23254' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23255' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23256' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23257' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23258' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23259' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23260' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23261' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23262' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23263' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23264' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23265' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23266' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23267' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23268' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23269' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23270' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23273' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23274' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23275' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23276' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23296' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23301' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23310' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23328' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23620' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history h WHERE h.itemid='23635' ORDER BY h.clock DESC LIMIT 2 OFFSET 0)
hosts.php:572 ? CAPIObject->delete() ? CAPIObject->__call() ? czbxrpc::call() ? czbxrpc::callAPI() ? call_user_func() ? CHost->delete() ? CItem->delete() ? CTrigger->get() ? CTrigger->addRelatedObjects() ? CItem->get() ? CItem->addRelatedObjects() ? CHistoryManager->getLast() ? DBunion() ? DBselect() in /var/www/zabbix/2.2/include/db.inc.php:525

SQL (0.000574): (SELECT * FROM history_uint h WHERE h.itemid='23271' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history_uint h WHERE h.itemid='23287' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history_uint h WHERE h.itemid='23289' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history_uint h WHERE h.itemid='23290' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history_uint h WHERE h.itemid='23291' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history_uint h WHERE h.itemid='23292' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history_uint h WHERE h.itemid='23313' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history_uint h WHERE h.itemid='23315' ORDER BY h.clock DESC LIMIT 2 OFFSET 0) UNION ALL (SELECT * FROM history_uint h WHERE h.itemid='23316' ORDER BY h.clock DESC LIMIT 2 OFFSET 0)
hosts.php:572 ? CAPIObject->delete() ? CAPIObject->__call() ? czbxrpc::call() ? czbxrpc::callAPI() ? call_user_func() ? CHost->delete() ? CItem->delete() ? CTrigger->get() ? CTrigger->addRelatedObjects() ? CItem->get() ? CItem->addRelatedObjects() ? CHistoryManager->getLast() ? DBunion() ? DBselect() in /var/www/zabbix/2.2/include/db.inc.php:525



 Comments   
Comment by Eduards Samersovs (Inactive) [ 2013 Nov 27 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-7445

Comment by Alexander Vladishev [ 2013 Nov 27 ]

Successfully tested!

Please review my changes in r40554.

Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Nov 28 ]

Fixed in versions 2.3.0 (trunk) r.40562, 2.2.1rc1 r.40561

Comment by Pavels Jelisejevs (Inactive) [ 2013 Nov 28 ]

(1) There are some other places where we unnecessarily retrieve item history data, a couple of them:

  • forms.inc.php:1062 (using API_OUTPUT_EXTEND);
  • CEvent.php:170 (using API_OUTPUT_REFER by default).

Please check all of the item.get calls and selectItems usages and make sure we don't use API_OUTPUT_EXTEND and API_OUTPUT_REFER anywhere.

You can check out the changes in svn://svn.zabbix.com/branches/dev/ZBXNEXT-2017. I've removed most of the API_OUTPUT_REFER usages there, may be it will help you find the places that need to be fixed.

Eduards Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-7445 r.40615

sasha REOPENED

  • undefined indexes in popup.php:
    Undefined index: type [ in frontends/php/popup.php:884]
    Undefined index: value_type [ in frontends/php/popup.php:885]
    Undefined index: status [ in frontends/php/popup.php:886]
    Undefined index: state [ in frontends/php/popup.php:886]
    
  • getItemFormData() $options cannot be used here as local variable because it is used in parameters of this function
  • getItemFormData() redundant data in Item()->get()
    'error', 'lastlogsize', 'mtime', 'flags', 'state'
  • frontends/php/items.php:940 redundant data in Item()->get()
    'snmp_community', 'snmp_oid', 'trapper_hosts', 'units', 'multiplier', 'delta',
    'snmpv3_securityname', 'snmpv3_securitylevel', 'snmpv3_authpassphrase', 'snmpv3_privpassphrase',
    'formula', 'lastlogsize', 'logtimefmt', 'valuemapid', 'delay_flex', 'params',
    'ipmi_sensor', 'data_type', 'authtype', 'username', 'password', 'publickey', 'privatekey', 'mtime',
    'filter', 'interfaceid', 'port', 'description', 'inventory_link', 'lifetime',
    'snmpv3_authprotocol', 'snmpv3_privprotocol', 'snmpv3_contextname'
    
  • frontends/php/include/classes/import/CXmlImport18.php:1358 redundant data in Item()->get() array('itemid') will be enough

Eduards RESOLVED r.40736

sasha CLOSED

Please review my changes in r.40741 before a merge.

Eduards OK, CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Dec 09 ]

Fixed in versions 2.3.0 (trunk) r.40849, 2.2.2rc1 r.40848

Generated at Fri Apr 26 07:12:51 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.