Skip to content

Seeing "sqlite3.OperationalError: database is locked" Error #8708

Discussion options

You must be logged in to vote

Thanks, good question. This error seems expected if you try to share a cache across processes, as you suspected 👍 .

  1. Are there any recommended upper limits for number of subprocesses ?

Depends a bit on where you're running. c7n-org is the most common tool for fanning out custodian executions, and it defaults to cpu count * 4. Which seems as reasonable a starting point as any.

  1. Is it possible to use a separate sqlite db for cache per subprocess to avoid the locking?

Yes. You can use the -f / --cache argument to the custodian run command. Again using c7n-org as a reference, it fans out into separate workers for account/region pairs. And it uses ~/.cache/c7n-org/<account>-<region>.cache

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nikunj-badjatya
Comment options

Answer selected by nikunj-badjatya
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants