Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix prefetcher concurrent map read and write issue #63

Conversation

andyzhang2023
Copy link
Contributor

@andyzhang2023 andyzhang2023 commented Feb 20, 2024

Description

It's a bug. The triePrefetcher structure should be thread safe, and it occasionally crashes the service with fatal error of "concurrent map read and write" on the map fetchers. We just add a lock to protected the map here.

Changes

the map fetchers will be protected by an RWMutex, and there are five function calls in which the map fetchers will be accessed:

  • prefetch(): read and write, need to be Lock
  • trie(): read only, need to be RLock
  • copy(): read only, need to be RLock
  • close(): read and wirte, need to be Lock
  • used(): read only, need to be RLock

@github-actions github-actions bot requested review from bnoieh and welkin22 February 20, 2024 01:16
welkin22
welkin22 previously approved these changes Feb 21, 2024
Copy link
Contributor

@welkin22 welkin22 left a comment

Choose a reason for hiding this comment

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

LGTM

owen-reorg
owen-reorg previously approved these changes Feb 27, 2024
Copy link
Collaborator

@owen-reorg owen-reorg left a comment

Choose a reason for hiding this comment

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

LGTM

andyzhang2023 added 2 commits March 4, 2024 15:22
@andyzhang2023 andyzhang2023 dismissed stale reviews from owen-reorg and welkin22 via bfdd2d3 March 4, 2024 07:25
@owen-reorg
Copy link
Collaborator

close this issue for now since we removed the feature in the v0.3.0 release

@owen-reorg owen-reorg closed this Mar 18, 2024
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.

5 participants