Skip to content

buckets: make a copy of all event maps before pouring the event to a bucket#4481

Open
blotus wants to merge 2 commits into
masterfrom
data-race-buckets-meta
Open

buckets: make a copy of all event maps before pouring the event to a bucket#4481
blotus wants to merge 2 commits into
masterfrom
data-race-buckets-meta

Conversation

@blotus
Copy link
Copy Markdown
Member

@blotus blotus commented May 20, 2026

Fixes #4459.

This introduces additional allocations each time we pour an item to a bucket, but there's probably no way around this: the maps must be owned by each buckets.

As a side-effect, this also fixes a potential race conditions in the meta:

  • Scenario A sets a new meta with evt.SetMeta
  • Scenario B overflows
  • The meta set by scenario A would appear in the meta of the alert generated by scenario B because the maps were shared between all buckets.

@github-actions
Copy link
Copy Markdown

@blotus: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.

  • /kind feature
  • /kind enhancement
  • /kind refactoring
  • /kind fix
  • /kind chore
  • /kind dependencies
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
Copy link
Copy Markdown

@blotus: There are no area labels on this PR. You can add as many areas as you see fit.

  • /area agent
  • /area local-api
  • /area cscli
  • /area appsec
  • /area security
  • /area configuration
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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.89%. Comparing base (5ce91a0) to head (60fe0aa).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4481      +/-   ##
==========================================
+ Coverage   63.88%   63.89%   +0.01%     
==========================================
  Files         478      478              
  Lines       34298    34307       +9     
==========================================
+ Hits        21911    21921      +10     
+ Misses      10231    10228       -3     
- Partials     2156     2158       +2     
Flag Coverage Δ
bats 46.51% <100.00%> (+0.02%) ⬆️
unit-linux 37.33% <100.00%> (+0.08%) ⬆️
unit-windows 26.02% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data race in pkg/leakybucket.EventsFromQueue causes 'concurrent map iteration/read and map write' panic (v1.7.7)

1 participant