Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] ConcurrentModificationException breaks Enforcer when calling Enforce() #361

Closed
ArthurBalabushko opened this issue Sep 22, 2023 · 3 comments · Fixed by #390
Closed

Comments

@ArthurBalabushko
Copy link

ArthurBalabushko commented Sep 22, 2023

it is similar to this issue casbin/casbin#1318

casbin-spring-boot-starter: 1.1.0
useSyncedEnforcer: false
storeType: jdbc
enableWatcher: false
AddNamedMatchingFunc(): KeyMatch4

model.conf

[request_definition]
r = sub, obj

[policy_definition]
p = sub, obj, eft

[role_definition]
g = _, _

[policy_effect]
e = !some(where (p.eft == deny))

[matchers]
m = r.sub == p.sub && g(r.obj, p.obj)

exception:

java.util.ConcurrentModificationException: null
	at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1511)
	at java.base/java.util.HashMap$EntryIterator.next(HashMap.java:1544)
	at java.base/java.util.HashMap$EntryIterator.next(HashMap.java:1542)
	at org.casbin.jcasbin.rbac.DefaultRoleManager.getRole(DefaultRoleManager.java:111)
	at org.casbin.jcasbin.rbac.DefaultRoleManager.hasLink(DefaultRoleManager.java:186)
	at org.casbin.jcasbin.rbac.DomainManager.hasLink(DomainManager.java:148)
	at org.casbin.jcasbin.util.BuiltInFunctions$GenerateGFunctionClass$1.variadicCall(BuiltInFunctions.java:378)
	at com.googlecode.aviator.runtime.function.AbstractVariadicFunction.call(AbstractVariadicFunction.java:71)
	at Script_1695382193455_59.execute0(Script_1695382193455_59:1)
	at com.googlecode.aviator.ClassExpression.executeDirectly(ClassExpression.java:44)
	at com.googlecode.aviator.BaseExpression.execute(BaseExpression.java:237)
	at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:540)
	at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:646)
@casbin-bot
Copy link
Member

@tangyang9464 @imp2002

@ArthurBalabushko ArthurBalabushko changed the title ConcurrentModificationException breaks Enforcer when calling Enforce() [Bug] ConcurrentModificationException breaks Enforcer when calling Enforce() Sep 25, 2023
@praneethc18
Copy link

can someone help with this, I faced the same issue with keyMatch4

@hsluoyz hsluoyz added bug and removed question labels Feb 19, 2024
@rajp33
Copy link

rajp33 commented Feb 29, 2024

Also happened with loadFilteredPolicy for me
Screenshot 2024-02-29 at 12 24 45 PM

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