Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-5307

PHP runs out of memory when creating complex templates

XMLWordPrintable

      I have a template, that has two parent templates with trigger dependencies between the parent templates. When I'm trying to import the templates from zbx_export_templates(3).xml PHP runs out of memory. I suspect this is caused by trigger dependencies.

      Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 41 bytes) in /opt/lampp/htdocs/zabbix/trunk/frontends/php/include/classes/debug/CProfiler.php on line 232
      Call Stack

      1. Time Memory Function Location
        1 0.0006 373020 {main}

        ( ) ../conf.import.php:0
        2 0.1514 8089600 CConfigurationImport->import( ) ../conf.import.php:130
        3 1.0412 21862848 CConfigurationImport->processTriggers( ) ../CConfigurationImport.php:157
        4 1.8153 28655488 CAPIObject->update( ) ../CConfigurationImport.php:970
        5 1.8153 28655676 CAPIObject->__call( ) ../CConfigurationImport.php:970
        6 1.8154 28656092 czbxrpc::call( ) ../CAPIObject.php:35
        7 1.8155 28658128 czbxrpc::callAPI( ) ../class.czbxrpc.php:64
        8 1.8156 28658680 call_user_func ( ) ../class.czbxrpc.php:106
        9 1.8156 28658696 CTrigger->update( ) ../class.czbxrpc.php:106
        10 2.2226 31307052 CTrigger->addDependencies( ) ../CTrigger.php:1308
        11 2.2296 31421104 CTrigger->addDependencies( ) ../CTrigger.php:1478
        12 2.2460 31726992 CTrigger->addDependencies( ) ../CTrigger.php:1478
        13 2.2460 31727152 CTrigger->validateAddDependencies( ) ../CTrigger.php:1445
        14 2.2461 31727700 CTrigger->checkDependencies( ) ../CTrigger.php:1431
        15 18.6377 268279632 DBselect( ) ../CTrigger.php:1847
        16 18.6381 268280984 CProfiler->profileSql( ) ../db.inc.php:485
        17 18.6382 268281216 debug_backtrace ( ) ../CProfiler.php:232

      After that the database becomes locked and an attempt to update something in the frontend results in errors like:

      Error in query [SELECT nextid FROM ids WHERE nodeid=0 AND table_name='hosts' AND field_name='hostid' FOR UPDATE] [Lock wait timeout exceeded; try restarting transaction]
      mysql_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:569]
      mysql_free_result() expects parameter 1 to be resource, boolean given [include/db.inc.php:570]
      Error in query [DELETE FROM ids WHERE nodeid=0 AND table_name='hosts' AND field_name='hostid'] [Lock wait timeout exceeded; try restarting transaction]
      DBEXECUTE_ERROR

            Unassigned Unassigned
            jelisejev Pavels Jelisejevs (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: