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

Template full clone exhaust memory (large system)

    Details

    • Team:
      Team D
    • Sprint:
      Sprint 34, Sprint 35, Sprint 36, Sprint 37, Sprint 38, Sprint 39, Sprint 40, Sprint 41, Sprint 42, Sprint 43, Sprint 44, Sprint 45, Sprint 46, Nov 2018
    • Story Points:
      2

      Description

      Problem is the same as ZBX-12933

      It's impossible create template full clone (if there is LLD).

      The problem is that it eats up too much memory more than 2GB.

      log:

      PHP Fatal error:  Allowed memory size of 2147483648 bytes exhausted (tried to allocate 77 bytes) in /usr/share/zabbix/include/classes/api/services/CDiscoveryRule.php on line 1137
      

      Workaround:

      Changed (in /zabbix/include/classes/api/services/CDiscoveryRule.php:1137):

       

      foreach ($newPrototypes as $i => $newPrototype) {
         unset($newPrototypes[$i]['templateid']);
      }

       

      To:

       

      reset($newPrototypes);
      
      while(current($newPrototypes)){
          unset($newPrototypes[key($newPrototypes)]['templateid']);
          next($newPrototypes);
      }
      

      While loop eats less memory, then foreach.

       

      With this solution we achieved that full clone does not eat up memory (and stop crashing), but the cloning process still is taking very long time (you may need to increase execution time).

      For us this is problem to clone templates in large system.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gcalenko Gregory Chalenko
                Reporter:
                Maris Maris Danne
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: