Giter Site home page Giter Site logo

Comments (11)

sagilio avatar sagilio commented on July 23, 2024 2

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.

hsluoyz avatar hsluoyz commented on July 23, 2024 1

If you cannot reproduce it, it cannot be fixed.

from casbin.net.

casbin-bot avatar casbin-bot commented on July 23, 2024

@sagilio @sociometry @AsakusaRinne

from casbin.net.

sagilio avatar sagilio commented on July 23, 2024

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.

v-loboda avatar v-loboda commented on July 23, 2024

This happen in the Default PolicyStore.Node class in TryAddPolicy and TryRemovePolicy, lines 74 and 133 respectively.

from casbin.net.

dmolochnikov avatar dmolochnikov commented on July 23, 2024

Hello! Any updates on this issue?

from casbin.net.

hsluoyz avatar hsluoyz commented on July 23, 2024

@v-loboda @dmolochnikov can you provide stable reproduce steps? and also:

  1. Casbin.NET version?
  2. Related code (like a test case)
  3. Casbin model
  4. Casbin policy

from casbin.net.

v-loboda avatar v-loboda commented on July 23, 2024

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.

  1. It was 2.1.1 version
  2. 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 == "*")
  1. Policy pattern: ["user1", "test1", "test1", "test1"]

from casbin.net.

hsluoyz avatar hsluoyz commented on July 23, 2024

@v-loboda how to reproduce it stably?

from casbin.net.

v-loboda avatar v-loboda commented on July 23, 2024

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.

seanamorosoamtote avatar seanamorosoamtote commented on July 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.