mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-07-19 09:32:30 -04:00
Deadlock detection (errno 1213) is part of normal InnoDB operation under contention; the engine rolls back the loser and expects the caller to re-run the statement on a fresh transaction. Most callers into zmDbDo go through autocommit, where there's no caller-managed transaction state for a retry to disturb. When AutoCommit is on, retry the statement up to 5 times with exponential backoff (~100ms -> ~1.6s, jittered). When AutoCommit is off, the caller owns the transaction and a unilateral retry would silently succeed against a TX that no longer reflects the work the caller staged before this statement; preserve the existing behavior of logging and returning undef so the caller can rebuild the TX itself. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>