Rollback on mysql_deadlock_restart_transaction
Posted: 20 March 2021, 15:01
I need to understand more about transaction rollback.
I have a bug where some exception occurs (in this case, a SQL deadlock exception, but really it should not matter) and the BGA framework does not properly clean up. From the stack trace, you can see the ajax action initiated by the user causes a transition to state #90. Then it runs stCleanup() (which is 'action' for state #90) where something goes wrong. In case of unexpected exception, the BGA framework should do a full transaction roll back and cancel all the changes in the stack -- aka, it should undo the transition to state #90 -- but that is not happening. Instead, my game is left in limbo in state #90, and the user is unable to do anything. I do not care about fixing the deadlock itself -- occasional deadlocks is inevitable and the solution is just to retry -- but how do I deal with this broken exception handling behavior? Because the BGA framework does not undo everything, the user is not taken back to the point before they clicked, so they are not given the option to retry.
I have a bug where some exception occurs (in this case, a SQL deadlock exception, but really it should not matter) and the BGA framework does not properly clean up. From the stack trace, you can see the ajax action initiated by the user causes a transition to state #90. Then it runs stCleanup() (which is 'action' for state #90) where something goes wrong. In case of unexpected exception, the BGA framework should do a full transaction roll back and cancel all the changes in the stack -- aka, it should undo the transition to state #90 -- but that is not happening. Instead, my game is left in limbo in state #90, and the user is unable to do anything. I do not care about fixing the deadlock itself -- occasional deadlocks is inevitable and the solution is just to retry -- but how do I deal with this broken exception handling behavior? Because the BGA framework does not undo everything, the user is not taken back to the point before they clicked, so they are not given the option to retry.
Code: Select all
20/03 06:41:29 [error] [T157099380] [85702250/thomas3633] Unexpected exception: mysql_deadlock_restart_transaction (BGA service error 1616218889)
#0 /var/tournoi/release/games/hardback/210315-0450/modules/CardMgr.class.php(442): APP_DbObject::DbQuery('UPDATE card SET...')
#1 /var/tournoi/release/games/hardback/210315-0450/modules/CardMgr.class.php(648): CardMgr::moveHandToTableau(85528055)
#2 /var/tournoi/release/games/hardback/210315-0450/hardback.game.php(1256): CardMgr::reset(85702250)
#3 /var/tournoi/release/tournoi-210316-1128/www/game/module/table/gamestate.game.php(469): hardback->stCleanup()
#4 /var/tournoi/release/tournoi-210316-1128/www/game/module/table/gamestate.game.php(365): Gamestate->jumpToState(90)
#5 /var/tournoi/release/games/hardback/210315-0450/hardback.game.php(1208): Gamestate->nextState('next')
#6 /var/tournoi/release/games/hardback/210315-0450/hardback.action.php(193): hardback->skip()
#7 /var/tournoi/release/tournoi-210316-1128/www/include/webActionCore.inc.php(189): action_hardback->skipPurchase()
#8 /var/tournoi/release/tournoi-210316-1128/www/index.php(247): launchWebAction('hardback', 'action_hardback', 'skipPurchase', false, false, NULL, true, false)
#9 {main}
http://boardgamearena.com/8/hardback/hardback/skipPurchase.html?lock=ea31be09-4f1b-4a33-84a2-c563e2838f72&table=157099380&dojo.preventCache=1616218889469