Commit 218e9f1
committed
FIX: Fix PHP memory exhaustion on maps with many hosts
The #437 memory fix made host-/servicegroup members lazy, but the
follow-up "Restore service list in host hover menus" (CMK-35933) kept
plain host objects loading eagerly, because hosts had no num_members
fallback to drive the frontend lazy fetch.
As a result, viewing a map with many hosts and services still queued
GET_SINGLE_MEMBER_STATES for every host, so fetchHostMemberDetails()
instantiated a NagVisService object for every service of every host in
a single request, exhausting the 128 MB PHP memory limit.
Extend the lazy loading to hosts:
1. NagVisHost::getNumMembers() derives the service count from the cheap
aggregate hostMemberState counts (excluding the host's own state), so
the frontend can trigger the lazy getObjectMembers fetch on hover.
2. NagVisMapObj::queueState() queues hosts lazily like groups, but only
when recognize_services is enabled, since that is the only case in
which the aggregate service state counts are fetched. Without it,
hosts keep loading their services eagerly to avoid altering the
summary state.
CMK-366031 parent daf34e5 commit 218e9f1
3 files changed
Lines changed: 57 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
92 | 130 | | |
93 | 131 | | |
94 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
367 | 375 | | |
368 | 376 | | |
369 | 377 | | |
370 | | - | |
| 378 | + | |
371 | 379 | | |
372 | 380 | | |
373 | 381 | | |
374 | 382 | | |
375 | 383 | | |
376 | | - | |
377 | | - | |
| 384 | + | |
| 385 | + | |
378 | 386 | | |
379 | 387 | | |
380 | 388 | | |
| |||
0 commit comments