Skip to content

fix(db): set a busy_timeout PRAGMA for SQLite connections - #64301

Open
CarlSchwan wants to merge 1 commit into
masterfrom
fix/sqlite-busy-timeout
Open

CarlSchwan wants to merge 1 commit into
masterfrom
fix/sqlite-busy-timeout

Conversation

@CarlSchwan

Copy link
Copy Markdown
Member

Summary

SQLite's default busy timeout is 0, so a connection that finds the database locked by a concurrent writer fails immediately with "database is locked" instead of waiting briefly for the lock to clear. This is easy to hit even on small/single-user instances when two requests (e.g. a background poll and a user action) touch the DB at the same time.

Add a 'sqlite.busy_timeout' config option (default 30000ms) wired through the same path as the existing 'sqlite.journal_mode' option, and apply it via PRAGMA busy_timeout in SQLiteSessionInit.

The main usecase, is to avoid some flaky tests in the CI with this

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

SQLite's default busy timeout is 0, so a connection that finds the
database locked by a concurrent writer fails immediately with
"database is locked" instead of waiting briefly for the lock to
clear. This is easy to hit even on small/single-user instances when
two requests (e.g. a background poll and a user action) touch the
DB at the same time.

Add a 'sqlite.busy_timeout' config option (default 30000ms) wired
through the same path as the existing 'sqlite.journal_mode' option,
and apply it via PRAGMA busy_timeout in SQLiteSessionInit.

Assisted-by: ClaudeCode:claude-sonnet-5
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan CarlSchwan added this to the Nextcloud 36 milestone Sep 14, 2026
@CarlSchwan CarlSchwan self-assigned this Sep 14, 2026
@CarlSchwan
CarlSchwan requested a review from a team as a code owner September 14, 2026 09:58
@CarlSchwan CarlSchwan added the 3. to review Waiting for reviews label Sep 14, 2026
@CarlSchwan
CarlSchwan requested review from Altahrim, come-nc, icewind1991 and provokateurin and removed request for a team September 14, 2026 09:58
@CarlSchwan CarlSchwan added the feature: database Database related DB label Sep 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted feature: database Database related DB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants