Bug #37870 | Assertion in convert_constant_item: result = 0 | ||
---|---|---|---|
Submitted: | 4 Jul 2008 13:00 | Modified: | 11 Nov 2008 21:35 |
Reporter: | Philip Stoev | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S1 (Critical) |
Version: | 5.0 -r2646, 5.1 - r2673 , 6.0 - r2764 | OS: | Any |
Assigned to: | Evgeny Potemkin | CPU Architecture: | Any |
[4 Jul 2008 13:00]
Philip Stoev
[4 Jul 2008 13:09]
Philip Stoev
The query in question is: SELECT OUTR . `date_key` AS X FROM C AS OUTR WHERE NOT EXISTS ( SELECT COUNT( INNR . `datetime_nokey` ) FROM CC AS INNR WHERE INNR . `date_nokey` = 241 OR OUTR . `date_key` < 109 GROUP BY INNR . `datetime_key` HAVING X < 49 ) AND NOT ( OUTR . `int_key` >= 174 AND NOT OUTR . `date_key` >= OUTR . `int_key` ) GROUP BY OUTR . `int_key` LIMIT 5 However executing the same query again on its own does not cause a crash.
[5 Jul 2008 11:30]
Philip Stoev
Grammar file for bug 37870
Attachment: bug37870.yy (text/plain), 3.36 KiB.
[5 Jul 2008 11:34]
Philip Stoev
To reproduce this bug, please clone the mysql-test-extra-6.0 tree and: $ cd mysql-test-extra-6.0/mysql-test/gentest $ ./runall.pl --basedir=/location/of/mysql-6.0 --engine=myisam \ --threads=5 --queries=1000000 --grammar=/path/to/bug37870.yy This will start a server, create the test tables and proceed to run random queries generated from the grammar in the .yy file. The crash will happen anywhere from 5 seconds to two hours of running the test (5 threads and 2 CPU cores). More threads and more CPU cores may or may not help reduce the time-to-crash. To run against an existing server, please use: $ ./gentest.pl --gendata --engine=myisam --threads=5 \ --queries=1000000 --grammar=/path/to/bug37870.yy \ --dsn=dbi:mysql:host=127.0.0.1:port=9306:user=root:database=test Please let me know if a better/simplifed/in other format test case is required.
[9 Jul 2008 16:05]
Philip Stoev
Setting to Open so that the bug verification team can check previous releases.
[17 Jul 2008 8:08]
Philip Stoev
Affects 5.1 bzr as well.
[12 Aug 2008 18:19]
Sveta Smirnova
Thank you for the report. Verified as described.
[17 Oct 2008 7:55]
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/56436 2765 Evgeny Potemkin 2008-10-17 Bug#37870: Usage of uninitialized value caused failed assertion. The convert_constant_item function converts a constant to integer using field for condition like 'field = a_constant'. When the convert_constant_item is called for a subquery the outer select is already being executed, so convert_constant_item saves field's value to prevent its corruption. For EXPLAIN field's value isn't initialized thus when convert_constant_item tries to restore saved value it fails assertion. Now the convert_constant_item doesn't save/restore field's value for EXPLAIN.
[27 Oct 2008 9:24]
Evgeny Potemkin
The reported stack trace seems to belongs to the bug#37937. The reported assertion occurs only on EXPLAIN queries.
[27 Oct 2008 9:26]
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/57091 2765 Evgeny Potemkin 2008-10-27 Bug#37870: Usage of uninitialized value caused failed assertion. The convert_constant_item function converts a constant to integer using field for condition like 'field = a_constant'. When the convert_constant_item is called for a subquery the outer select is already being executed, so convert_constant_item saves field's value to prevent its corruption. For EXPLAIN field's value isn't initialized thus when convert_constant_item tries to restore saved value it fails assertion. Now the convert_constant_item doesn't save/restore field's value for EXPLAIN.
[28 Oct 2008 17:33]
Philip Stoev
Evgeny, I am getting this assertion even on workloads that contain no EXPLAIN and no "=" operator at all.
[5 Nov 2008 13:11]
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/57889 2694 Evgeny Potemkin 2008-11-05 Bug#37870: Usage of uninitialized value caused failed assertion. The convert_constant_item function converts a constant to integer using field for condition like 'field = a_constant'. In some cases the convert_constant_item is called for a subquery when outer select is already being executed, so convert_constant_item saves field's value to prevent its corruption. For EXPLAIN and at the prepare phase field's value isn't initialized yet, thus when convert_constant_item tries to restore saved value it fails assertion.
[5 Nov 2008 15:00]
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/57904 2694 Evgeny Potemkin 2008-11-05 Bug#37870: Usage of uninitialized value caused failed assertion. The convert_constant_item function converts a constant to integer using field for condition like 'field = a_constant'. In some cases the convert_constant_item is called for a subquery when outer select is already being executed, so convert_constant_item saves field's value to prevent its corruption. For EXPLAIN and at the prepare phase field's value isn't initialized yet, thus when convert_constant_item tries to restore saved value it fails assertion. Now the convert_constant_item doesn't save/restore field's value if it's haven't been read yet. Outer constants values are always saved.
[5 Nov 2008 15:40]
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/57912 2694 Evgeny Potemkin 2008-11-05 Bug#37870: Usage of uninitialized value caused failed assertion. The convert_constant_item function converts a constant to integer using field for condition like 'field = a_constant'. In some cases the convert_constant_item is called for a subquery when outer select is already being executed, so convert_constant_item saves field's value to prevent its corruption. For EXPLAIN and at the prepare phase field's value isn't initialized yet, thus when convert_constant_item tries to restore saved value it fails assertion. Now the convert_constant_item doesn't save/restore field's value if it's haven't been read yet. Outer constant values are always saved.
[10 Nov 2008 10:53]
Bugs System
Pushed into 6.0.8-alpha (revid:epotemkin@mysql.com-20081105204624-0typ2ug2w5qcmylq) (version source revid:mattias.jonsson@sun.com-20081106095916-hp895g17ase9ie7b) (pib:5)
[10 Nov 2008 11:37]
Bugs System
Pushed into 5.1.30 (revid:epotemkin@mysql.com-20081105204624-0typ2ug2w5qcmylq) (version source revid:epotemkin@mysql.com-20081105204624-0typ2ug2w5qcmylq) (pib:5)
[11 Nov 2008 16:05]
Paul DuBois
The versions are actually 5.1.31, 6.0.9.
[11 Nov 2008 21:35]
Paul DuBois
Noted in 5.1.31, 6.0.9 changelog. Use of an uninitialized constant in EXPLAIN evaluation caused an assertion failure.
[19 Jan 2009 11:25]
Bugs System
Pushed into 5.1.31-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090119095303-uwwvxiibtr38djii) (version source revid:tomas.ulin@sun.com-20090108105244-8opp3i85jw0uj5ib) (merge vers: 5.1.31-ndb-6.2.17) (pib:6)
[19 Jan 2009 13:02]
Bugs System
Pushed into 5.1.31-ndb-6.3.21 (revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (version source revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (merge vers: 5.1.31-ndb-6.3.21) (pib:6)
[19 Jan 2009 16:08]
Bugs System
Pushed into 5.1.31-ndb-6.4.1 (revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (version source revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (merge vers: 5.1.31-ndb-6.4.1) (pib:6)