[ZBX-14396] Template full clone exhaust memory (large system) Created: 2018 May 24 Updated: 2024 Apr 10 Resolved: 2018 Nov 08 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | API (A) |
Affects Version/s: | 3.4.8 |
Fix Version/s: | 3.4.15rc1, 4.0.2rc1, 4.2.0alpha1, 4.2 (plan) |
Type: | Problem report | Priority: | Major |
Reporter: | Maris Danne | Assignee: | Gregory Chalenko |
Resolution: | Fixed | Votes: | 0 |
Labels: | fullcloning, template | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
||||||||||||
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 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. |
Comments |
Comment by Alexander Vladishev [ 2018 Jul 17 ] |
Main problem was introduced in |
Comment by Alexander Vladishev [ 2018 Oct 15 ] |
Performance tests: Environment:
Operation: Full clone of "Zabbix server": Total time: 0.918612 Total SQL time: 0.530619 SQL count: 1426 (selects: 867 | executes: 559) Peak memory usage: 124M After the fix: Total time: 0.570373 Total SQL time: 0.460414 SQL count: 1426 (selects: 867 | executes: 559) Peak memory usage: 22M |
Comment by Gregory Chalenko [ 2018 Nov 08 ] |
Fixed in:
|
Comment by richlv [ 2018 Nov 25 ] |
(1) The changelog entry is "fixed memory usage during template full clone" - perhaps a more accurate version could be "fixed excessive memory usage during template full clone" gcalenko Thank you. Changelog message fixed in r87329. |