Closed damienmiheev closed 2 years ago
@tangyang9464 @imp2002
@imp2002
Sorry guys, I rather had a problem with my redis test container / watcher configuration than casbin. Issue is not valid.
Ok, now the environment is well configured, unfortunately issue is still here.
All my tests are running on same docker containers stack, so the db and redis are shared between integration tests. I mentioned that the issue becomes visible, in the middle of test running, when there are already some numbers of rows in casbin_rule
table.
@damienmiheev plz try to troubleshoot by yourself for several days to make sure it really exists, if still valid, make a new issue
I'm using
org.casbin:casbin-spring-boot-starter:0.4.2
andorg.casbin:jcasbin:1.27.0
. Synchronisation over redis is enabled: useSyncedEnforcer: true. The policies is stored in postgres db.The model is a simple ACL:
Application is a single app, but it has multiple modules, communicated through the rabbitmq.
Time to time i'm getting ArrayIndexOutOfBoundsException error here:
org/casbin/jcasbin/main/CoreEnforcer.java:524
So if i clearly understood, it initialises
policyEffects = new Effect[policyLen]
array of lengthmodel.model.get("p").get(pType).policy.size())
, but then during the for loop, it becomes bigger.As i said before the app is a monolith where the Enforcer is a singleton bean which is shared between the modules. Based on async rabbit message handling, different modules perform
enforcer.addPolicies
andenforcer.removePolicies
. Meanwhile i'm getting ArrayIndexOutOfBoundsException onenforcer.batchEnforce
.I expected that enforcer is thread safe when the sychronisation over redis is enabled, but maybe I missing something? Could you please help me to solve the issue.