Skip to content

Mark all channels inactive when a large IOC disconnects - #192

Open
anderslindho wants to merge 2 commits into
ChannelFinder:masterfrom
anderslindho:fix/disconnect-beyond-query-limit
Open

anderslindho wants to merge 2 commits into
ChannelFinder:masterfrom
anderslindho:fix/disconnect-beyond-query-limit

Conversation

@anderslindho

Copy link
Copy Markdown
Contributor

Only the first findSizeLimit channels of an IOC (10,000 by default) were marked Inactive when it disconnected - the rest stayed Active (until the next clean by cleanOnStart, cleanOnStop or recceiver-clean).

The recCeiver gets the channels of an IOC from ChannelFinder with one iocid query. It marks the channels in that result Inactive, and no others. The query was capped at findSizeLimit and not paged. It now pages with ~search_after on disconnect. ChannelFinder sorts results by name, and ~search_after starts the next page after a given name. ~from could not be used because ChannelFinder rejects a query past the Elasticsearch result window, which is 10,000 by default.

Paging is only done for a disconnect or a commit without records. A connected commit with records does not need the full list. Its channels past the first page are found by name, so it still makes one capped query. A large IOC that uploads in batches makes one query per batch, as before.

~search_after needs ChannelFinder 4.7.0. Older versions read the parameter as a property filter and return an empty second page. The result is then the first page only, as before this change. The paging also stops with a warning if a page starts or ends at or before the last name of the previous page.

The second commit corrects the findSizeLimit comment in the example configs. It said an unset value falls back to the ChannelFinder default, but the recCeiver uses its own default of 10,000.

Only the first `findSizeLimit` channels of an IOC (10,000 by default)
were marked `Inactive` when it disconnected. The rest stayed `Active`
until the next clean by `cleanOnStart`, `cleanOnStop` or
`recceiver-clean`.

The recCeiver gets the channels of an IOC from ChannelFinder with one
`iocid` query. It marks the channels in that result `Inactive`, and no
others. The query was capped at `findSizeLimit` and not paged.

The query now pages with `~search_after` on disconnect. ChannelFinder
sorts results by name, and `~search_after` starts the next page after
a given name. `~from` could not be used because ChannelFinder rejects a
query past the Elasticsearch result window, which is 10,000 by default.

Paging is only done for a disconnect or a commit without records. A
connected commit with records does not need the full list. Its channels
past the first page are found by name, so it still makes one capped
query. A large IOC that uploads in batches makes one query per batch,
as before.

`~search_after` needs ChannelFinder 4.7.0. Older versions read the
parameter as a property filter and return an empty second page. The
result is then the first page only, as before this change. The paging
also stops with a warning if a page starts or ends at or before the
last name of the previous page.
The example configs said an unset `findSizeLimit` falls back to the
ChannelFinder default. The recCeiver uses its own default of 10,000
instead. The comment now says so. It also says that marking more
channels than the limit `Inactive` on disconnect needs ChannelFinder
4.7.0 or newer.
@anderslindho anderslindho self-assigned this Nov 18, 2026
@sonarqubecloud

Copy link
Copy Markdown

A page is requested while the previous one came back full. With a size limit of 0 the single
query carries no `~size`, so ChannelFinder applies its own cap.
"""
args = [(CFPropertyName.IOC_ID.value, iocid)]

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.

Should probably also add the recciever_id intot he filter.

Should we make this more generic and combine with the clean code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

On combining with clean_service: I'd rather not build on that, I think the sweep should go away once CF can tell that a recCeiver is gone. But I can add the recceiver_id. Fine?

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