From 73689ccf9b798df2b87d25808c926c9b5d185e2e Mon Sep 17 00:00:00 2001 From: 1060778506 <1060778506@qq.com> Date: Mon, 2 Mar 2026 20:54:37 +0800 Subject: [PATCH] QueryDeadlockError (1020) on fresh Docker install with MariaDB 11 when Insights is installed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Environment - Frappe version: v15.101.3 (latest) - Insights version: 3.3.1 - MariaDB: 11.8 (official docker image) - Deployment: Docker (custom image based on frappe/bench) - Transaction isolation: REPEATABLE-READ (default) ## Steps to Reproduce 1. Fresh Docker deployment 2. Install Insights 3. Login for the first time 4. System automatically creates User → Contact 5. Background job `create_contact` runs 6. Error occurs ## Error QueryDeadlockError: (1020, "Record has changed since last read in table 'tabContact'") Traceback attached below. ## Observation - If Insights is NOT installed → no error - If database isolation level is changed to READ-COMMITTED → no error ## Suspected Cause Insights hooks on Contact insert/update may be triggering additional DB reads/writes within the same transaction, which conflicts with MariaDB 11 default REPEATABLE READ isolation. ## Question Should Insights defer its hooks using enqueue_after_commit=True or after_commit mechanism to avoid transaction conflicts under default MariaDB settings? --- overrides/compose.mariadb.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/overrides/compose.mariadb.yaml b/overrides/compose.mariadb.yaml index e79288c0..e969f3c7 100644 --- a/overrides/compose.mariadb.yaml +++ b/overrides/compose.mariadb.yaml @@ -21,6 +21,7 @@ services: - --collation-server=utf8mb4_unicode_ci - --skip-character-set-client-handshake - --skip-innodb-read-only-compressed # Temporary fix for MariaDB 10.6 + - --transaction-isolation=READ-COMMITTED environment: MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-123} MARIADB_AUTO_UPGRADE: 1