Repository navigation
Description
/kind enhancement
What would you like to be added?
When a blocklist pull brings in a large list, insert it in chunks spread over time instead of one SaveAlerts call, with both the chunk size and the gap between chunks configurable:
api:
server:
online_client:
pull:
blocklists: true
chunk_size: 10000
chunk_interval: 60sA 72,863-entry list would then land as 8 chunks over ~8 minutes. Each chunk is a separate bounded delta for bouncers, so the biggest response any bouncer can get from one pull drops by the chunk factor.
One detail worth building in: chunk_interval needs to exceed the fleet's poll interval, or a bouncer whose poll straddles two chunks collects both and the pacing buys nothing.
Why is this needed?
There is currently no way to stop a single blocklist pull from putting the LAPI into an OOM loop.
Ours inserted 89,416 decisions in four seconds on 2026-09-25, one subscribed list accounting for 72,863:
00:58:21Z lists:firehol_cruzit_web_attacks 13,205
00:58:23Z lists:crowdsec_cve_2024_4577 3,348
00:58:25Z lists:crowdsec_cve_2025_55182 72,863
00:59:28Z OOM: Killed process (crowdsec) anon-rss:19020740kB
01:00:44Z OOM: Killed process (crowdsec) anon-rss:18953200kB
01:02:06Z OOM: Killed process (crowdsec) anon-rss:19018436kB
63 seconds from the last insert to the first kill: one poll interval. With ~1.2k bouncers on a 60s poll, every one of them pulled the whole 89k-row delta at once and the engine ran out of memory. It then repeats, because a kill takes every in-flight stream with it and UpdateBouncerStreamPull only runs on a completed response, so no cursor advances and the fleet retries in lockstep.
We already chunk our own cscli decisions import this way — a fixed number of IPs per invocation with a pause between — and it is the only reason importing a 100k list is survivable at this fleet size. The CAPI path has no equivalent seam: updateBlocklist attaches every decision to one alert and saves it in a single call, decision_bulk_size splits the SQL round trips but they run back-to-back so ids come out consecutive, and pull.blocklists is a bool. Unsubscribing from the list is the only lever an operator has.
Related to #4703, which is the same gap on the retention side.
Activity
tommy-ng0 commentedon Sep 28, 2026
/kind enhancement
github-actions commentedon Sep 28, 2026
@tommy-ng0: Thanks for opening an issue, it is currently awaiting triage.
In the meantime, you can:
Details
I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.
github-actions commentedon Sep 28, 2026
@tommy-ng0: There are no 'kind' label on this issue. You need a 'kind' label to start the triage process.
/kind feature/kind enhancement/kind refactoring/kind bug/kind packagingDetails
I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.
blotus commentedon Sep 28, 2026
Hello,
Inserting in chunks feels like putting a band-aid on an open wound, and would make understanding what is blocked at any given time quite hard.
The decision stream endpoint holds at most one page of 30k decisions per request in memory, and with that many bouncers querying LAPI, it's not surprising to consume that much memory.
I see potentially 2 solutions (they are not mutually exclusives):
tommy-ng0 commentedon Oct 1, 2026
@blotus those solutions sound good to me. Let me know if I can help :)
lapi: optionally limit concurrent decision stream requests
lapi: optionally limit concurrent decision stream requests
lapi: optionally limit concurrent decision stream requests (#4747)
blotus commentedon Oct 16, 2026
Closing as #4747 and #4733 have been merged.