Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite database is locked error #1670

Open
dukhaSlayer opened this issue Jan 9, 2025 · 1 comment
Open

SQLite database is locked error #1670

dukhaSlayer opened this issue Jan 9, 2025 · 1 comment

Comments

@dukhaSlayer
Copy link

dukhaSlayer commented Jan 9, 2025

By default, SQLite doesn't support multiple connections.
It can be enabled either with a shared cache or write-ahead log feature.

Default connection # for Hikari: DEFAULT_POOL_SIZE = 10,
which under the load produces exceptions:
org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

I'd advise doing

config.setMaximumPoolSize(1);

in org.asamk.signal.manager.storage.Database#getHikariDataSource or trying enabling WAL with PRAGMA (not sure it will solve the issue completely though, if two connections will try to write simultaneously).

More info:
https://stackoverflow.com/questions/10325683/can-i-read-and-write-to-a-sqlite-database-concurrently-from-multiple-connections

@dukhaSlayer
Copy link
Author

Also wanted to ask why it is using IMMEDIATE transaction mode? :)

        sqliteConfig.setTransactionMode(SQLiteConfig.TransactionMode.IMMEDIATE);

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

No branches or pull requests

1 participant