Closed hulb closed 7 months ago
:tada: This issue has been resolved in version 3.22.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
It seems that the test above still fails. Now there seems be some kind of dead lock issue. I think the set adapter way won't make it right https://github.com/casbin/gorm-adapter/blob/1f2965ad10a4ce97d91267ec9f51ca97f7833b84/adapter.go#L691-L692
The new-added test TestTransactionRace
will fail when add up the cocurrency like to 100.
The new-added test
TestTransactionRace
will fail when add up the cocurrency like to 100.
That's true, I will make a new PR to increase concurrency in the test recently.
@hulb Before I moving on, I should say the easiest way is to add mutex lock for the whole Transaction
function. Actually not all implements of IEnforcer
are thread-safe. That means we cannot do concurrent operations safely without changing the function signature. Is that acceptable for you? Do you have other ideas?
No, I agree. There is no other better way in my mind. Thanks for asking and the hard work!
It seems
SetAdapter
is not threa-safe:https://github.com/casbin/gorm-adapter/blob/1f2965ad10a4ce97d91267ec9f51ca97f7833b84/adapter.go#L691-L692
It can be verified by this unit test:
The test will fail by :