Skip to content

fix Pull iterator data race#156

Merged
yuchen-db merged 3 commits intodb_mainfrom
yuchen-db/fix-coroutine-leak
Apr 21, 2025
Merged

fix Pull iterator data race#156
yuchen-db merged 3 commits intodb_mainfrom
yuchen-db/fix-coroutine-leak

Conversation

@yuchen-db
Copy link
Collaborator

@yuchen-db yuchen-db commented Apr 20, 2025

Go's Pull iterator prohibits calling next() and stop() simultaneously (code pointer). Use a mutex to protect Recv() and CloseSend() which essentially calls next() and stop().
The race is introduced in thanos-io#7821 and happens rarely during a query timeout

@yuchen-db yuchen-db requested review from hczhu-db and jnyi April 20, 2025 01:39
@yuchen-db yuchen-db changed the title fix coroutine leak fix Pull iterator data race Apr 20, 2025
Copy link
Collaborator

@jnyi jnyi left a comment

Choose a reason for hiding this comment

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

nice finding, would you also submit this change to upstream?

@yuchen-db yuchen-db merged commit 7a35f32 into db_main Apr 21, 2025
14 checks passed
@yuchen-db yuchen-db deleted the yuchen-db/fix-coroutine-leak branch April 21, 2025 18:11
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.

3 participants