From 599b1bab6012f8527624a9e2d2468eef81276117 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Jun 2026 11:30:46 +0530 Subject: [PATCH] ci: don't run background workers during patch-test migrate The Patch Test starts the full bench (incl. workers) and then runs migrate. Migrate enqueues orphan-link cleanup jobs (delete_dynamic_links) that the workers pick up and process while migrate is altering tables, which intermittently fails with MySQL 1412 'Table definition has changed, please retry transaction'. Start every bench process except the workers during migrate, so nothing consumes the queue mid-migrate. Redis and the other services stay up; the queued jobs just wait. --- .github/workflows/patch.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml index 96816e59dee..2c7a0236c5b 100644 --- a/.github/workflows/patch.yml +++ b/.github/workflows/patch.yml @@ -119,6 +119,15 @@ jobs: git -C "apps/frappe" remote set-url upstream https://github.com/frappe/frappe.git git -C "apps/erpnext" remote set-url upstream https://github.com/frappe/erpnext.git + # Start every bench process except the background workers. If workers run during a + # migrate, they pick up the orphan-link cleanup jobs it enqueues and race its schema + # changes, which fails with MySQL 1412 "Table definition has changed". Redis and the + # other services stay up; the queued jobs simply wait and are harmless here. + function start_bench_without_workers() { + local procs + procs=$(awk -F: '/^[a-z_]+:/ && $1 !~ /worker/ {print $1}' ~/frappe-bench/Procfile) + honcho start -f ~/frappe-bench/Procfile $procs &>> ~/frappe-bench/bench_start.log & + } function update_to_version() { version=$1 @@ -137,7 +146,7 @@ jobs: rm -rf ~/frappe-bench/env bench -v setup env --python python$2 bench pip install -e ./apps/erpnext - bench start &>> ~/frappe-bench/bench_start.log & + start_bench_without_workers bench --site test_site migrate } @@ -154,7 +163,7 @@ jobs: rm -rf ~/frappe-bench/env bench -v setup env bench pip install -e ./apps/erpnext - bench start &>> ~/frappe-bench/bench_start.log & + start_bench_without_workers bench --site test_site migrate