Bug #50786 | Assertion `thd->mdl_context.trans_sentinel() == __null' failed in open_ltable() | ||
---|---|---|---|
Submitted: | 1 Feb 2010 9:56 | Modified: | 7 Mar 2010 1:04 |
Reporter: | Philip Stoev | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Locking | Severity: | S1 (Critical) |
Version: | mysql-next-4284-stage | OS: | Any |
Assigned to: | Jon Olav Hauglid | CPU Architecture: | Any |
[1 Feb 2010 9:56]
Philip Stoev
[1 Feb 2010 10:04]
Philip Stoev
Core and binary: http://mysql-systemqa.s3.amazonaws.com/var-bug50786.zip source: revision-id: kostja@sun.com-20100129154650-wmq5gczzj868s66r date: 2010-01-29 18:46:50 +0300 build-date: 2010-02-01 12:04:43 +0200 revno: 3084 branch-nick: mysql-next-4284-stage
[1 Feb 2010 17:27]
Philip Stoev
grammar for bug 50786
Attachment: bug50786.yy (application/octet-stream, text), 31.71 KiB.
[1 Feb 2010 17:29]
Philip Stoev
To reproduce : $ perl runall.pl \ --gendata=conf/WL5004_data.zz \ --duration=60 \ --queries=10000000 \ --basedir=/build/bzr/mysql-next-4284-stage \ --mysqld=--innodb-lock-wait-timeout=1 \ --mysqld=--table-lock-wait-timeout=1 \ --grammar=conf/bug50786.yy \ --mem next-4284 is also affected. The grammar produces the following queries: CREATE TABLE IF NOT EXISTS . t1_base2_S LIKE test.table0_int_autoinc ; ALTER TABLE . t1_base2_S ENGINE = MEMORY ; INSERT INTO . t1_base2_S SELECT * FROM test.table0_int_autoinc ; COMMIT ; ; DROP TABLE . t1_base2_S; LOCK TABLES . t1_base2_S AS j READ
[3 Feb 2010 6:13]
Dmitry Lenev
Hello! The same assert can be triggered using the following test case for mysqltest tool. connect (con1,localhost,root,,test,,); connect (con2,localhost,root,,test,,); connect (con3,localhost,root,,test,,); connection default; create table t1 (i int); create table t2 (i int); select @@global.general_log, @@global.log_output; set @@global.log_output= 'TABLE'; --echo connection: con1 connection con1; handler t1 open; --echo connection: con3 connection con3; set @@session.sql_log_off= 1; --echo connection: con2 connection con2; set debug_sync='thr_multi_lock_after_thr_lock SIGNAL parked WAIT_FOR go'; # The below statement will be blocked on debug sync point # after it will get write lock on mysql.general_log table. --send select 1; --echo connection: con3 connection con3; set debug_sync= 'now WAIT_FOR parked'; --echo connection: con1 connection con1; # Again this statement will be blocked in open_ltable() when # trying to write into mysql.general_log. --send select 1; --echo connection: con3 connection con3; --sleep 1 show processlist; # The below ALTER will try to abort statement in connection con1, # since the latter waits on table-level lock while having HANDLER # open. This will cause mysql_lock_tables() in con1 fail and will # trigger assert. --send alter table t1 add column j int;
[3 Feb 2010 10:05]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/99032 3064 Jon Olav Hauglid 2010-02-03 Bug #50786 Assertion `thd->mdl_context.trans_sentinel() == __null' failed in open_ltable() The problem was too restrictive asserts that enforced that open_ltable() was called without any active HANDLERs, LOCK TABLES or global read locks. However, this can happen when opening a system table (such as mysql.general_log) since we there backup the current open tables context and use a separate context. This patch adjusts the assert to check for the presence of backed up contexts. The patch also fixes set_needs_thr_lock_abort() that before ignored its parameter and always set the member variable to TRUE. Test case added to mdl_sync.test. Thanks to Dmitry Lenev for help with this bug!
[3 Feb 2010 13:08]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/99056 3064 Jon Olav Hauglid 2010-02-03 Bug #50786 Assertion `thd->mdl_context.trans_sentinel() == __null' failed in open_ltable() The problem was too restrictive asserts that enforced that open_ltable() was called without any active HANDLERs, LOCK TABLES or global read locks. However, this can happen in several cases when opening system tables. The assert would, for example, be triggered when drop function was called from a connection with active HANDLERs as this would cause open_ltable() to be called for mysql.proc. The assert could also be triggered when using table-based general log (mysql.general_log). This patch removes the asserts since they will be triggered in several legitimate cases and because the asserts are no longer relevant due to changes in how locks are released. The patch also fixes set_needs_thr_lock_abort() that before ignored its parameter and always set the member variable to TRUE. Test case added to mdl_sync.test. Thanks to Dmitry Lenev for help with this bug!
[3 Feb 2010 14:09]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/99065 3067 Jon Olav Hauglid 2010-02-03 Bug #50786 Assertion `thd->mdl_context.trans_sentinel() == __null' failed in open_ltable() The problem was too restrictive asserts that enforced that open_ltable() was called without any active HANDLERs, LOCK TABLES or global read locks. However, this can happen in several cases when opening system tables. The assert would, for example, be triggered when drop function was called from a connection with active HANDLERs as this would cause open_ltable() to be called for mysql.proc. The assert could also be triggered when using table-based general log (mysql.general_log). This patch removes the asserts since they will be triggered in several legitimate cases and because the asserts are no longer relevant due to changes in how locks are released. The patch also fixes set_needs_thr_lock_abort() that before ignored its parameter and always set the member variable to TRUE. Test case added to mdl_sync.test. Thanks to Dmitry Lenev for help with this bug!
[3 Feb 2010 14:12]
Jon Olav Hauglid
Pushed into the mysql-next-4284 tree. Setting the bug to Closed since it was reported against an internal tree and therefore does not require any documentation changes.
[16 Feb 2010 16:49]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100216101445-2ofzkh48aq2e0e8o) (version source revid:kostja@sun.com-20100210211106-nq8ztcq2z9o4csit) (merge vers: 6.0.14-alpha) (pib:16)
[16 Feb 2010 16:59]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100216101208-33qkfwdr0tep3pf2) (version source revid:kostja@sun.com-20100203151239-ok17dv0sgw4x0oeu) (pib:16)
[6 Mar 2010 11:08]
Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20100216221947-luyhph0txl2c5tc8) (merge vers: 5.5.99-m3) (pib:16)
[7 Mar 2010 1:04]
Paul DuBois
No changelog entry needed.