Closed
Description
Hi guys
We encountered a problem in an environment where intensive policy modification occurs. It's very difficult to reproduce, and I can't do it reliably.
We have rbac model, several nodes with synchronization via IWatcher and a lot of policy changes including removing them.
Sometimes, very rarely, we catch an error
Error Write lock may not be acquired with read lock held. This pattern is prone to deadlocks. Please ensure that read locks are released before taking a write lock. If an upgrade is necessary, use an upgrade lock in place of the read lock.
From my point of view, there are 3 problem pleces:
- DefaultPolicyStore.Node class, where PolicyTextSet collection can be changed from different threads in several places
- Casbin.Rbac.Role class where _roles collection can be changed from different threads
- InternalEnforce class and the InternalEnforce method, where Scanner.Interrupt is not executed on every execution path. This can lead to a deadlock in the internal Iterator->node.Lock, where after _node.Lock.EnterReadLock ExitReadLock will not be executed.
Metadata
Metadata
Labels
Type
Projects
Status
Casbin.NET Easy Tasks