Bug #19565 | crash in system test, trigger, InnoDB transaction deadlock | ||
---|---|---|---|
Submitted: | 5 May 2006 17:07 | Modified: | 31 Jul 2007 20:05 |
Reporter: | Matthias Leich | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Stored Routines | Severity: | S1 (Critical) |
Version: | 5.0, 5.1 | OS: | Any |
Assigned to: | Assigned Account | CPU Architecture: | Any |
Tags: | bfsm_2007_02_15, rt_q1_2007, trigger |
[5 May 2006 17:07]
Matthias Leich
[5 May 2006 17:09]
Matthias Leich
stacktrace
Attachment: stacktrace (application/octet-stream, text), 3.97 KiB.
[5 May 2006 22:48]
Heikki Tuuri
Hi! The reason is the code below. But InnoDB must be able to resolve a deadlock by a total rollback of the transaction. The fix may be to simply remove those assertions from handler.cc and test that an InnoDB error HA_ERR_LOCK_DEADLOCK will cause MySQL to return gracefully from the current SQL statement. It makes no sense to continue the processing of the current SQL statement if a total rollback has happened. Regards, Heikki handler.cc: int ha_commit_trans(THD *thd, bool all) { int error= 0, cookie= 0; THD_TRANS *trans= all ? &thd->transaction.all : &thd->transaction.stmt; bool is_real_trans= all || thd->transaction.all.nht == 0; handlerton **ht= trans->ht; my_xid xid= thd->transaction.xid_state.xid.get_my_xid(); DBUG_ENTER("ha_commit_trans"); if (thd->in_sub_stmt) { /* Since we don't support nested statement transactions in 5.0, we can't commit or rollback stmt transactions while we are inside stored functions or triggers. So we simply do nothing now. TODO: This should be fixed in later ( >= 5.1) releases. */ if (!all) DBUG_RETURN(0); /* We assume that all statements which commit or rollback main transaction are prohibited inside of stored functions or triggers. So they should bail out with error even before ha_commit_trans() call. To be 100% safe let us throw error in non-debug builds. */ DBUG_ASSERT(0); my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); DBUG_RETURN(2); } ### int ha_rollback_trans(THD *thd, bool all) { int error=0; THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt; bool is_real_trans=all || thd->transaction.all.nht == 0; DBUG_ENTER("ha_rollback_trans"); if (thd->in_sub_stmt) { /* If we are inside stored function or trigger we should not commit or rollback current statement transaction. See comment in ha_commit_trans() call for more information. */ if (!all) DBUG_RETURN(0); DBUG_ASSERT(0); my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); DBUG_RETURN(1); }
[15 Sep 2006 14:37]
Dmitry Lenev
Bug #22390 was marked as duplicate of this bug.
[15 Nov 2006 8:05]
Dmitry Lenev
Bug#24329 was marked as duplicate for this bug.
[16 Jan 2007 14:02]
Valeriy Kravchuk
Bug #24989 is likely a duplicate of this one (stack trace for crash of 5.0.36-debug looks really similar).
[31 Jul 2007 20:05]
Konstantin Osipov
This bug should be fixed by the fix for Bug#24989: The DEADLOCK error is improperly handled by InnoDB, which should be in the main tree by the end of this week. Setting the bug to duplicate. Please reopen the bug if the problem is still present.