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

cache: fix race when clearning a cache #261

Merged
merged 2 commits into from
Mar 18, 2021
Merged

Conversation

vmg
Copy link
Contributor

@vmg vmg commented Mar 18, 2021

Hiii!! Thanks for Ristretto, it's very nice! I've found an actual bug when wiring it up as a cache backend for Vitess; it can cause goroutines to block.

Fix and reproduction recipe attached!

When clearing a cache while other goroutines are actively `Wait`ing for
it, the waiting goroutines can become blocked indefinitely if one of the
cache items is flushed by the `Clear` code instead of by the background
worker, because the `Clear` code is not marking waitgroups as done.

This change is Reviewable

When clearing a cache while other goroutines are actively `Wait`ing for
it, the waiting goroutines can become blocked indefinitely if one of the
cache items is flushed by the `Clear` code instead of by the background
worker, because the `Clear` code is not marking waitgroups as done.
@CLAassistant
Copy link

CLAassistant commented Mar 18, 2021

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@karlmcguire karlmcguire left a comment

Choose a reason for hiding this comment

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

:lgtm: Great catch!

Reviewed 1 of 2 files at r1, 1 of 1 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @jarifibrahim, @manishrjain, and @martinmr)

@karlmcguire karlmcguire merged commit 74754f6 into dgraph-io:master Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants