BUG: Deadlock while cache eviction
Hi team,
This issue was first reported as per conversation on the discord community by Ritik. To replicate the issue, please follow the steps below:
- Update the KeysLimit in dice/config/config.go
var KeysLimit int = 2 // default buffer size. - Run following commands
mset a b c dworks fineset x yshould lead to deadlock
Upon initial debugging, I found the issue is due to the locks being acquired in functions when trying to set a new value. Please find the sequence leading to deadlock below:
- evalSet calls store.Put()
- store.Put() calls PutHelper with acquiring Lock()
- PutHelper() validates the key limit and goes for eviction via store.evict()
- In populateEvictionPool() we try to get RLock() to evict, which causes deadlock as Lock() is already acquired on step 2.
cc: @JyotinderSingh
Regards, Apoorv
Hey @apoorvyadav1111 are you picking this up? If not I would like to pick this up
Hey @aashraybhandar1 , You can pick this up. Though, I don't have GitHub permission to assign this issue to you. Apoorv
@aashraybhandar1 Assigned, thanks for contributing.
@lucifercr07 @apoorvyadav1111 Created a PR: #529 . Would appreciate feedback from you guys. Thank You!
No longer an issue since we removed all store level locks.