Hi,

On Thu, Feb 12, 2026 at 6:37 PM Maël <[email protected]> wrote:
>
> Hello,
>
> After upgrading from Trac 1.0.11 to Trac 1.6 with SQLite, I'm encountering 
> this error in logs:
>
> ERROR: Unable to create cache records for revision X in '(default)': 
> OperationalError('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 = 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. → "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 = sqlite:db/trac.db?journal_mode=wal&synchronous=normal


-- 
Jun Omae <[email protected]> (大前 潤)

-- 
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 email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/trac-users/CAEVLMajT3Gpm99W8TC0KEBjwpxoebCyPWUyUmO-v_69P5n-1CQ%40mail.gmail.com.

Reply via email to