Skip to content

lib/utility.php poller cache integrity bugs in update_poller_cache, push_out_data_input_method, push_out_host (1.2.x) #7133

@somethingwithproof

Description

@somethingwithproof

Four related bugs in the poller cache write paths on 1.2.x. They surfaced during a focused review prompted by TheWitness's broader 1.2.31 thread on data sources and graph templates not populating poller_item.

`update_poller_cache($id, $commit = true)` at lib/utility.php:566 only flushes when `cacti_sizeof($poller_items)` is non-zero. When a data source becomes inactive, loses its data input, fails the whitelist, or otherwise produces no items, the buffer pass that would mark existing rows present=0 and DELETE the leftovers never runs. Stale poller_item rows for that data source persist indefinitely. data_sources.php:351 calls this with $commit=true expecting the cache to match the data source state.

`push_out_data_input_method()` at lib/utility.php:594 drops the first data source for every non-first poller. The poller-boundary if-branch flushes the buffer and resets the buffers, but only the else-branch appends the current data source. So when the iteration crosses into a new poller, the data source that triggered the boundary is lost: not appended to the new buffer, not rebuilt this cycle. Affects any multi-poller install rebuilding poller cache via a data input method change.

`push_out_host($host_id, $local_data_id, $data_template_id)` at lib/utility.php:969 derives the buffer's poller from `SELECT poller_id FROM host WHERE id = $host_id` even when called with $host_id=0 and $local_data_id>0 (the data_sources.php save_component_data_source signature). poller_id resolves to 0/null, the flush writes to poller 0, and the rows are stranded.

Typo at lib/utility.php:927: `isset($old_value['value'])` against an undefined $old_value (only $old_data exists) always returns false. The intended PCACHE change log for host-field propagation is suppressed.

The newer develop-only data_input_data column-expansion bugs are filed separately in #7131. None of those are present on 1.2.x.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions