Comments (11)
I believe this issue is indeed likely to occur, and it's very possible that the problem arises from making changes to the same Node while the Scanner is not interrupted. I will continue to try to find a way to consistently reproduce it, and once I find a method or have a new idea, I will reopen this issue.
During the discussion, there are other potential issues, I will create a new issue to link them.
from casbin.net.
If you cannot reproduce it, it cannot be fixed.
from casbin.net.
@sagilio @sociometry @AsakusaRinne
from casbin.net.
Hi! Thank you for your feedback. I will review your points later and it would be helpful if you could provide more details like the error throw line.
from casbin.net.
This happen in the Default PolicyStore.Node class in TryAddPolicy and TryRemovePolicy, lines 74 and 133 respectively.
from casbin.net.
Hello! Any updates on this issue?
from casbin.net.
@v-loboda @dmolochnikov can you provide stable reproduce steps? and also:
- Casbin.NET version?
- Related code (like a test case)
- Casbin model
- Casbin policy
from casbin.net.
Hi, as I said before, it is hard to reprocude becase of multithreaded nature. You just need to modify your policies in several threads and read them simultaneously. In the first message I have pointed out several places that do not meet the multithreading requirements.
- It was 2.1.1 version
- There is no specific code, just multithreaded operations with AddPoliciesAsync, AddRoleForUserAsync, RemovePolicyAsync, EnforceAsync and GetImplicitPermissionsForUser
[request_definition]
r = sub, resource_type, resource, act
[policy_definition]
p = sub, resource_type, resource, act
[role_definition]
g = _, _
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = g(r.sub, p.sub) && (r.resource_type == p.resource_type || p.resource_type == "*") && (r.resource == p.resource || p.resource == "*") && (r.act == p.act || p.act == "*")
- Policy pattern: ["user1", "test1", "test1", "test1"]
from casbin.net.
@v-loboda how to reproduce it stably?
from casbin.net.
I would make a test case if I could reproduce the bug reliably.
I was able to reproduce it several times by running the modification and receiving permissions in multiple threads and waiting for errors for a long time. Sometimes the error appeared within a few seconds.
from casbin.net.
I definitely see similar issues. I didn't reproduce the deadlocking in a test yet, but I am seeing it as well. However, The PR I submitted here handles some issues as well as a test case that would fail prior in the same vein of concurrent access issues. #361
I would urge the team to investigate all usages of HashSet reading and writing as they are not thread safe.
from casbin.net.
Related Issues (20)
- Where can I find ASP.NET 6 examples? HOT 7
- Check collection in ABAC with policy HOT 4
- Updating Policies directly on the IPolicyStore model not reflected in Enforcer HOT 4
- Rules work on Casbin Editor but not on Casbin.Net HOT 6
- Use semantic-release to auto release new versions HOT 2
- Apply politic to objects of different class going to excaption, but in posible in Go version HOT 5
- .NET library does not support multi-line mode with '\' line feeds HOT 1
- Cannot add named groups in Casbin v2 HOT 3
- Cannot get Policy with null value in EF core Adapter. HOT 8
- bug: fix CI error: error: Response status code does not indicate success: 413 (The total packages size for the pending uploads is too large. The feed owner may have to upgrade the MyGet subscription to resolve this issue.). HOT 2
- How to return a custom type instead of using IQueryable type in IPolicyFilter HOT 3
- System.ArgumentOutOfRangeException during high read/write scenarios HOT 3
- Lacked exist check when add policy HOT 2
- Using RBAC w/ Domain pattern matching can lead to unexpected results HOT 2
- Breaking change in expression parsing between versions 1.5.0 and 2.5.3 HOT 5
- Multiple Request Types with Eval HOT 5
- Support .NET 9.0 target HOT 3
- Eval not supported in non-generic enforces (request of policy size > 12) HOT 4
- TypeInitializationException when trying to reference a version of CsvHelper newer than v30.x HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from casbin.net.