Skip to content

Conversation

wangy8961
Copy link

@wangy8961 wangy8961 commented Dec 9, 2020

[Fix] cannot see the insert/update/delete records from other transaction when use multi processes(eg. Nginx reverse proxy)

If you start two processes: transaction01 for process01, and transaction02 for process02
The default isolation level of MySQL is RR
When you insert/update/delete from transaction01, then transaction02 can't see the modify

We need to:

Before you call e.enforce(sub, obj, act),need to call e.load_policy()
In e.load_policy(), we need to commit the transaction before execute the SELECT SQL

[Fix] the failing check of CI, unittest for the current version code(59334bb)

Cameron Hurst and others added 11 commits September 22, 2020 13:48
When casbin.Enforcer is created, Adapter.load_policy() will be called,
but sqlalchemy session is not commited in Adapter.load_policy(). The
connection to database is held all the time till the first database
operation, if the time interval between casbin.Enforcer created and
first database operation occurs, exceeds database timeout setting, database
operations like add_policy() and remove_policy() will raise timeout
exception.
feat: allow CasbinRule customization
…on when use multi processes(eg. Nginx reverse proxy)
@yyellowsun
Copy link
Contributor

yyellowsun commented Dec 9, 2020

@wangy8961 Could you please provide some test examples?

@hsluoyz
Copy link
Member

hsluoyz commented Dec 9, 2020

Need advice from @techoner

@hsluoyz
Copy link
Member

hsluoyz commented Jan 8, 2021

Closed as stale.

@hsluoyz hsluoyz closed this Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants