Re: [Trac] "database is locked" error after upgrading from Trac 1.0.11 to 1.6 (SQLite)
Jun Omae <[email protected]> Thu, 12 Feb 2026 23:12:06 +0900
| Newsgroups | gmane.comp.version-control.subversion.trac.general |
|---|---|
| Message-ID | <CAEVLMajT3Gpm99W8TC0KEBjwpxoebCyPWUyUmO-v_69P5n-1CQ@mail.gmail.com> |
Hi,
On Thu, Feb 12, 2026 at 6:37=E2=80=AFPM Ma=C3=ABl <mael.fcbarcelone@outlook=
.fr> wrote:
>
> Hello,
>
> After upgrading from Trac 1.0.11 to Trac 1.6 with SQLite, I'm encounterin=
g this error in logs:
>
> ERROR: Unable to create cache records for revision X in '(default)': Oper=
ationalError('database is locked')
>
> Environment:
> - SQLite database
> - Custom workflow plugin that commits to SVN during ticket transitions
> - SVN post-commit hook calls trac-admin changeset added
> - PRAGMA busy_timeout =3D 0 (default)
>
> Root cause:
> Trac 1.6 introduced nested transactions in versioncontrol/cache.py:
>
> - sync() opens a transaction (line 182)
> - insert_changeset() opens another transaction (line 286)
>
> This creates an inter-process conflict with SQLite:
> 1. Apache process: ticket transition + SVN commit
> 2. Post-commit hook: triggers trac-admin changeset added immediately
> 3. trac-admin process: tries to sync while Apache's transaction is still =
open
> 4. =E2=86=92 "database is locked"
>
> Trac 1.0.11 passed the transaction as parameter (no nested transactions),=
so this didn't occur.
>
> Questions:
>
> - Is this a known issue with Trac 1.6 + SQLite + SVN hooks?
No known issues.
> - Is there an official workaround for nested transactions in cache.py?
I don't think it is caused by versioncontrol/cache.py. Because Trac
DB-API doesn't support nested transaction. I guess that your custom
workflow plugin has something wrong.
I don't know if effective, "PRAGMA journal_mode WAL" and "PRAGMA
synchronous NORMAL" might help it. The parameters can be set in [trac]
database option like the following:
[trac]
database =3D sqlite:db/trac.db?journal_mode=3Dwal&synchronous=3Dnormal
--=20
Jun Omae <[email protected]> (=E5=A4=A7=E5=89=8D =E6=BD=A4)
--=20
You received this message because you are subscribed to the Google Groups "=
Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to trac-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To view this discussion visit https://groups.google.com/d/msgid/trac-users/=
CAEVLMajT3Gpm99W8TC0KEBjwpxoebCyPWUyUmO-v_69P5n-1CQ%40mail.gmail.com.