Flaky E2E: write conflict on step/guide row locks under parallel runs #43
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MassiveDynamic/kataba#43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Running the full Playwright suite in parallel,
e2e/authoring.spec.tsore2e/access.spec.tsfails roughly every other run. The server logs:The error comes from a
queryRawlock (lockStep/lockGuide,SELECT … FOR UPDATE) while adding the annotated step and its image. It reproduces withe2e/categories.spec.tsexcluded, so it predates #41.Likely cause to check: MariaDB's snapshot isolation (error 1020, "record has changed since last read") when a transaction reads before taking its
FOR UPDATElock, or when two requests touch the same rows (e.g. the shared E2E category).Acceptance criteria
Root cause: MySQL 8.4 (not MariaDB) gap-lock deadlocks (1213, which Prisma reports as TransactionWriteConflict). Under REPEATABLE READ, deleting the Step Lines of two empty steps took the same index gap lock, and each insert then waited for the other. A second risk: saveStep locked guide→step while image and annotation actions locked step→guide. Fixed in #46: READ COMMITTED for all transactions, and one lock order (the guide's lock first; lockStep removed). See ADR-0013. The parallel suite passed 14 times in a row with no retries.