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 concurrency race issue when setting values concurrently. #277

Closed
wants to merge 1 commit into from

Conversation

NiuBlibing
Copy link

This patch resolves the issue by implementing read-write locks to protect against cache misses and prevent repeated invocations of the underlying function.

This patch resolves the issue by implementing read-write locks to protect
against cache misses and prevent repeated invocations of the underlying function.
@npezolano
Copy link

This seems to have fixed the issues I was running into as well albeit it runs slightly slower now due to the multiple locks

@tkem
Copy link
Owner

tkem commented Sep 18, 2023

@NiuBlibing Please correct me if I'm wrong, but if I understand this PR correctly, this will serialize all calls to the underlying function in case of a cache miss? No matter what their arguments are?

We had PR #224 which tried to introduce "key-level locking", which AFAICS would solve this issue more cleanly, but which was rejected because of the added complexity.

So, unless I completely misunderstood this, please check out #224 and explain your improvements in more detail, thanks!

@tkem tkem closed this Sep 18, 2023
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.

None yet

3 participants