v0.4.1 — fix slide-switch deadlock storm
Highlights
Slide-switch deadlock storm fixed. When a Slidev deck mounted multiple <PollResults /> panels (e.g. main view + presenter view), every slide switch fired close + activate POSTs from each mounted panel. Concurrent activates on the same poll's poll_questions rows acquired per-tuple row locks in different orders and deadlocked (PostgreSQL 40P01). Hikari connections then piled up on deadlock-victim retries and the next backoffice PATCH appeared to hang.
Fix
PollRepositoryImpl.activateQuestionandcloseActiveQuestionnow wrap the state-flipping UPDATE in adsl.transactionResultand takeSELECT polls … FOR UPDATEon the owning poll row up front. Every activate / close / header-update on the same poll serialises behind one row lock; the admin PATCH naturally takes the same lock via itsUPDATE polls, so the two paths can no longer interleave their per-question locks.- Added a package-private
findById(DSLContext, UUID)overload so the post-mutation read inside the transaction callback sees the writes the transaction has just made (the outer auto-commitdslwould have read pre-commit state on a different connection).
Tests
- New
PollActivateDeadlockIT: 16 threads × 25 iterations of interleavedactivate(qN)/closeActiveQuestion/updateHeaderon a single poll. Parametrised over PostgreSQL and H2. Asserts no SQL exception and the at-most-one-ACTIVE-question invariant.