Repository navigation
fix(automation): cap discovery network size and check address inserts - #8662
Open
somethingwithproof wants to merge 5 commits into
Open
somethingwithproof wants to merge 5 commits into
somethingwithproof wants to merge 5 commits into
Conversation
somethingwithproof
requested review from
TheWitness and
cigamit
and removed request for
a team
November 8, 2026 21:25
somethingwithproof
force-pushed
the
fix/automation-range-cap
branch
2 times, most recently
from
November 12, 2026 07:52
a9d3853 to
60ad2d0
Compare
github-actions
Bot
force-pushed
the
fix/automation-range-cap
branch
3 times, most recently
from
November 16, 2026 20:47
52840b9 to
6a558ed
Compare
somethingwithproof
force-pushed
the
fix/automation-range-cap
branch
from
November 17, 2026 21:44
6a558ed to
4306611
Compare
github-actions
Bot
force-pushed
the
fix/automation-range-cap
branch
2 times, most recently
from
November 20, 2026 08:48
cb04405 to
3751851
Compare
This was referenced Nov 23, 2026
Discovery scans part of a network without an error when the automation_ips table fills (1.2.x)
#8922
Closed
somethingwithproof
force-pushed
the
fix/automation-range-cap
branch
from
November 25, 2026 08:01
2f60717 to
557e97f
Compare
github-actions
Bot
force-pushed
the
fix/automation-range-cap
branch
from
November 25, 2026 20:47
557e97f to
3b2e64c
Compare
api_networks_save() summed the addresses of a network's ranges but never limited them, so a /8 primed 16.7M rows into the MEMORY table automation_ips. With the default 16M max_heap_table_size the table fills after about 28,000 rows, the failed batch INSERTs were not checked, and the master launched workers over a partial table. - Add the Automation setting 'Maximum Addresses per Network' (default 65536) and reject larger networks at save time with a message naming the count and the limit. Priming applies the same limit, so networks saved earlier or imported are refused instead of half primed. - Insert primed addresses through a prepared batch helper and stop the master, removing its rows, when an insert fails. - Look ignored addresses up in a keyed array instead of in_array(), and advance the walk past them; an ignored address inside a range never advanced $count and looped for ever. - Each worker re-read its claimed row with WHERE pid = ? AND thread = ? AND status = 0, which walks the pid index over every address that worker has already scanned (30,001 handler reads after 30,000 rows on MySQL 8.4 and MariaDB 10.11). Lead it with network_id and add a BTREE index on (network_id, status, pid); claim and fetch now read one row. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…insert failures Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…ller cleanup Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
automation_ips is keyed on ip_address, so an address from an overlapping range of the same network, or of another network primed at the same time, failed the whole batch insert. With the insert result now checked, that stopped the scan. Duplicates keep their existing row; a full MEMORY table still fails the insert. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
raise_message() escapes custom messages by default, so the caller must not pre-escape. Read the limit into a variable so the message fixture can render the statement, and record the rendered notification in the formatting fixture. The range-limit probe now doubles __() instead of __esc(). Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
github-actions
Bot
force-pushed
the
fix/automation-range-cap
branch
from
November 26, 2026 08:49
3b2e64c to
55725be
Compare
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Network discovery accepted ranges of any size and loaded every address into
automation_ip_addressin one go, without checking the inserts. With the default 16 MBmax_heap_table_sizethe memory table fills at about 28,000 rows, and workers then read past every claimed row on each fetch.api_networks_save()rejects larger networks with the address count and the limit, and priming checks the same limit so networks saved earlier are refused rather than half loaded.poller_automation.phpremoves that network's rows, clears its tasks and exits instead of starting workers.(network_id, status, pid)incacti.sql, the 1.3.0 upgrade anddocs/audit_schema.sql; the worker fetch now leads withnetwork_id. On MySQL 8.4 and MariaDB 10.11, after 30,000 rows the fetch went from 30,001 index reads to one.Verification:
tests/fixtures/Core/AutomationNetworkRangeLimit.php(registered in both coverage runners) plus a Pest wrapper; fails before the fix. Automation suite 32 passed; SQL interpolation baseline refreshed (9 to 7); PHPStan clean.Merge order: this PR and #8461, #8624 change the same lines of lib/api_automation.php, and this PR and #8461 change tests/fixtures/Core/message-formatting-expected.json. This PR and #8624 change the lib/api_automation.php lines in different ways, so no order is suggested between them; they need to be reconciled. #8461 is suggested after both. This PR and #8352, #8475, #8887 change install/upgrades/1_3_0.php. Suggested order for that file: this PR, then #8887, #8475, #8352. Whichever merges later will be rebased.