summaryrefslogtreecommitdiff
path: root/CLAUDE.md
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-06-18 16:42:20 +0100
committerLester Caine <lester@lsces.co.uk>2026-06-18 16:42:20 +0100
commitc5089d25cb60d7c4b819c4eab3cdbf2090ef192c (patch)
treed1085c404d314c791d10d0687b82f0c237556839 /CLAUDE.md
parent4df0bedd7694ee7638b6bc7d07c2eb34307c79b0 (diff)
downloadwiki-master.tar.gz
wiki-master.tar.bz2
wiki-master.zip
Add CLAUDE.md: document BitPage::store() missing RollbackTrans bugHEADmaster
Intermittent "page not found" traced to open Firebird transaction when an exception escapes store() before CompleteTrans() runs. Includes diagnostic query and proposed fix pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'CLAUDE.md')
-rw-r--r--CLAUDE.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 0000000..97b1393
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,36 @@
+# Wiki Package — Developer Notes
+
+## BitPage::store() — missing RollbackTrans
+`BitPage::store()` (line 220) wraps the entire save in `StartTrans()` / `CompleteTrans()`
+but has no `RollbackTrans()` fallback. If an exception escapes — e.g. from the nested
+`LibertyMime::store()` call at line 222, which has its own `StartTrans()` — `CompleteTrans()`
+never runs and Firebird is left with an open transaction holding locks on `wiki_pages`
+and/or `liberty_content` rows.
+
+Symptom: wiki pages return "page not found" until Firebird is restarted. The failed save
+appears to cause no visible error, but the stuck transaction blocks subsequent access to
+the affected rows.
+
+**Diagnostic** — run in isql when stuck:
+```sql
+SELECT t.MON$TRANSACTION_ID, t.MON$TIMESTAMP,
+ s.MON$SQL_TEXT, s.MON$STATE
+FROM MON$TRANSACTIONS t
+LEFT JOIN MON$STATEMENTS s ON s.MON$TRANSACTION_ID = t.MON$TRANSACTION_ID
+WHERE t.MON$STATE = 1;
+```
+
+**Fix** — wrap the body of `store()` in a try/catch with `RollbackTrans()`:
+```php
+$this->StartTrans();
+try {
+ // ... existing body ...
+ $this->CompleteTrans();
+} catch( \Exception $e ) {
+ $this->mDb->RollbackTrans();
+ $this->mErrors['store'] = $e->getMessage();
+}
+```
+
+Do not action until confirmed via `MON$TRANSACTIONS` — use xdebug or the monitoring
+query above to verify this is the actual call stack before patching.