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 race condition in locks issued by the file cache driver #43661

Closed
wants to merge 1 commit into from

Conversation

hbgl
Copy link

@hbgl hbgl commented Aug 11, 2022

This pull request fixes issue #43627.

TLDR:
Atomic locks issued by FileStore or other stores that use the HasCacheLock trait have a race condition when the lock timeout is zero (the default). This can cause multiple processes to concurrently enter a critical section protected by the lock.

The old lock implementation would do a non-atomic get and put when the lock timeout is less than or equal to zero and an atomic add otherwise. The new implementation always does an atomic add. This change only breaks code that incorrectly implemented their cache store, i.e. their add method cannot handle lock timeouts less or equal to zero.

@taylorotwell
Copy link
Member

Not sure I'm comfortable changing this on a patch release.

@driesvints
Copy link
Member

@hbgl can you try sending to master?

@hbgl
Copy link
Author

hbgl commented Aug 12, 2022

@driesvints Here is the new PR for master #43686

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