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

Already on GitHub? Sign in to your account

net.liftweb.util.SoftReferenceCache deadlocks when accessing an evicted reference #1319

Merged
merged 1 commit into from Oct 11, 2012

Conversation

Projects
None yet
3 participants
Owner

Shadowfiend commented Sep 14, 2012

SoftReferenceCache checks whether a reference is stale before returning it in its apply function. If the reference is stale, it attempts to acquire a write lock while holding a read lock, resulting in a deadlock.

Reproducible case at https://github.com/Shadowfiend/soft-reference-cache-deadlock (sbt run it).

Fix deadlock in SoftReferenceCache apply function.
When we find a stale SoftReference, release the read lock, then acquire
the write lock, double-check that the reference is still stale, and then
finally remove the entry from the cache.
Owner

fmpwizard commented on 9dc6352 Sep 27, 2012

+1

dpp pushed a commit that referenced this pull request Oct 11, 2012

Merge pull request #1319 from lift/asc_issue_1319
net.liftweb.util.SoftReferenceCache deadlocks when accessing an evicted reference

@dpp dpp merged commit 83fc031 into master Oct 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment