Bug #25219 | SELECT with subqueries causes MySQL server crash | ||
---|---|---|---|
Submitted: | 20 Dec 2006 15:04 | Modified: | 1 Feb 2007 1:55 |
Reporter: | Victoria Reznichenko | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S1 (Critical) |
Version: | 5.0bk | OS: | Any (any) |
Assigned to: | Igor Babaev | CPU Architecture: | Any |
Tags: | bfsm_2007_01_18 |
[20 Dec 2006 15:04]
Victoria Reznichenko
[20 Dec 2006 17:59]
MySQL Verification Team
Another testcase (based on first one), but produces a debug assertion, and very slightly different stack trace. ------------- DROP TABLE IF EXISTS `t4`; CREATE TABLE `t4` (`c1` int); DROP TABLE IF EXISTS `t3`; CREATE TABLE `t3` (`c1` int,`c2` int ); DROP TABLE IF EXISTS `t6`; CREATE TABLE `t6` (`c2` int,`c3` int); DROP TABLE IF EXISTS `t7`; CREATE TABLE `t7` (`c3` int); INSERT INTO `t4` VALUES (1); INSERT INTO `t3` VALUES (1,1); INSERT INTO `t6` VALUES (1,1); INSERT INTO `t7` VALUES (1); select 1 from ( SELECT c3 from t4 join t3 using (c1) join t6 using (c2) ) d1 where exists ( select c3 from t7 where c3=d1.c3 UNION select c3 from t7 ); ------------------
[16 Jan 2007 17:19]
Sergey Petrunya
At the very first glance this bug and its fixes are not sub/super-sets of fixes for BUG#24127, BUG#22930, BUG#24085.
[18 Jan 2007 8: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/18311 ChangeSet@1.2382, 2007-01-18 11:10:53+03:00, ted@ted.mysql.internal +1 -0 BUG#25219: SELECT with subqueries causes MySQL server crash fix: subselect joins should be just partially cleaned up if they are known to be uncacheable
[18 Jan 2007 8:31]
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/18313 ChangeSet@1.2382, 2007-01-18 11:31:14+03:00, ted@ted.mysql.internal +1 -0 BUG#25219: SELECT with subqueries causes MySQL server crash <QUITE UNRELATED!> fix: make_cond_for_table() cleaned up; hacks to workaround bug with quick selects avoided; see rejects against current test results attached to the bug page
[19 Jan 2007 3:44]
Igor Babaev
I had the same assertion abort with a simpler query that used no derived tables: mysql> CREATE TABLE t1 (id char(4) PRIMARY KEY, c int); Query OK, 0 rows affected (0.46 sec) mysql> CREATE TABLE t2 (c int); Query OK, 0 rows affected (0.03 sec) mysql> INSERT INTO t1 VALUES ('aa', 1); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t2 VALUES (1); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM t1 -> WHERE EXISTS (SELECT c FROM t2 WHERE c=1 -> UNION -> SELECT c from t2 WHERE c=t1.c); ERROR 2013 (HY000): Lost connection to MySQL server during query Making t1 not to be a single-row (constant) table did not help: mysql> INSERT INTO t1 VALUES ('bb', 2), ('cc', 3), ('dd',1); Query OK, 3 rows affected (0.01 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> SELECT * FROM t1 -> WHERE EXISTS (SELECT c FROM t2 WHERE c=1 -> UNION -> SELECT c from t2 WHERE c=t1.c); ERROR 2013 (HY000): Lost connection to MySQL server during query Making t2 not to be a single-row (constant) table does not help either with a slightly more complicated non-correlated SELECT: mysql> CREATE TABLE t3 (c int); ERROR 1050 (42S01): Table 't3' already exists mysql> INSERT INTO t3 VALUES (1); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM t1 -> WHERE EXISTS (SELECT t2.c FROM t2 JOIN t3 ON t2.c=t3.c WHERE t2.c=1 -> UNION -> SELECT c from t2 WHERE c=t1.c); ERROR 2013 (HY000): Lost connection to MySQL server during query In all these cases I had a failure with the same assertion abort: mysqld: sql_select.cc:10057: int do_select(JOIN*, List<Item>*, TABLE*, Procedure*): Assertion `join->tables' failed. Program received signal SIGABRT, Aborted.
[19 Jan 2007 8:14]
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/18418 ChangeSet@1.2386, 2007-01-19 00:17:28-08:00, igor@olga.mysql.com +4 -0 Fixed bug #25219: crash for a query that contains an EXIST subquery with UNION over correlated and uncorrelated SELECTS. In such subqueries each uncorrelated SELECT should be considered as uncacheable. Otherwise join_free is called for it and in many cases it causes some problems.
[28 Jan 2007 2:23]
Igor Babaev
The fix has been pushed into 5.0.36, 5.1.16-beta main trees.
[1 Feb 2007 1:55]
Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at http://dev.mysql.com/doc/en/installing-source.html Documented bugfix in 5.0.36 and 5.1.16 changelogs.