Skip to content

fix(boost): guard empty boost_parallel / max_records_per_select against div-by-zero#7181

Closed
somethingwithproof wants to merge 2 commits into
Cacti:1.2.xfrom
somethingwithproof:fix/1.2.x-boost-divzero-guards
Closed

fix(boost): guard empty boost_parallel / max_records_per_select against div-by-zero#7181
somethingwithproof wants to merge 2 commits into
Cacti:1.2.xfrom
somethingwithproof:fix/1.2.x-boost-divzero-guards

Conversation

@somethingwithproof

Copy link
Copy Markdown
Contributor

If boost_parallel or boost_rrd_update_max_records_per_select is unset (fresh upgrade, manual settings edit, plugin reset), ceil($n / $processes) / ceil($total_rows / $max_per_select) is a divide-by-zero (INF on 7.4, DivisionByZeroError on 8.x), and the downstream LIMIT 0 selects nothing — silently dropping the boost block. Adds empty() defaults (1 / 50000) in boost_prepare_process_table, boost_process_local_data_ids, and boost_rrdtool_function_update, matching the guard already present in boost_launch_children. Base: 1.2.x.

…ct config

When boost_parallel or boost_rrd_update_max_records_per_select is unset
(fresh upgrade, manual settings edit, plugin reset), ceil($n / 0) yields INF
(or DivisionByZeroError on PHP 8) and downstream LIMIT 0 selects nothing,
dropping the boost block. Default empties to 1 / 50000 to match the existing
guard in boost_launch_children.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Copilot AI review requested due to automatic review settings May 29, 2026 23:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds defensive defaults for Boost poller configuration values to prevent invalid runtime behavior when config options are unset/empty.

Changes:

  • Default boost_parallel to 1 when empty
  • Default boost_rrd_update_max_records_per_select to 50000 in two code paths

Comment thread poller_boost.php
Comment thread poller_boost.php
Comment thread poller_boost.php
…shifts

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof

Copy link
Copy Markdown
Contributor Author

Superseded by #7154. The remaining max-records-per-select guard from this branch has been folded into #7154 in commit 27439de.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants