ory / keto

The most scalable and customizable permission server on the market. Fix your slow or broken permission system with Google's proven "Zanzibar" approach. Supports ACL, RBAC, and more. Written in Go, cloud native, headless, API-first. Available as a service on Ory Network and for self-hosters.
https://www.ory.sh/?utm_source=github&utm_medium=banner&utm_campaign=keto
Apache License 2.0
4.84k stars 348 forks source link

Errors in memory dsn #1159

Open egorsmth opened 1 year ago

egorsmth commented 1 year ago

Preflight checklist

Describe the bug

Sometimes there is exception database table is locked: keto_uuid_mappings when running Keto with DSN=memory. I need to run in memory for tests. I guess there is some issue with sqlite configs.

Reproducing the bug

The error is not stable so I couldn't reproduce it. Run keto with DSN=memory

Relevant log output

database table is locked: keto_uuid_mappings`

Relevant configuration

DSN=memory

Version

0.10.0-alpha.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Docker

Additional Context

No response

zepatrik commented 1 year ago

AFAIK sqlite has problems with parallel queries. Can you try reducing the number of parallel requests in your test? In case you want to parallelize your tests, it would be better to use postgres or multiple Keto instances with sqlite in-memory. Cockroachdb also allows running in-memory iirc.