Bug #26830 | subquery, group by .. with rollup crashes server | ||
---|---|---|---|
Submitted: | 4 Mar 2007 5:43 | Modified: | 15 Mar 2007 3:00 |
Reporter: | Shane Bester (Platinum Quality Contributor) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: General | Severity: | S1 (Critical) |
Version: | 5.0.38BK, 5.1.17BK | OS: | Any (*) |
Assigned to: | Igor Babaev | CPU Architecture: | Any |
Tags: | crash, subquery, with rollup |
[4 Mar 2007 5:43]
Shane Bester
[4 Mar 2007 5:51]
MySQL Verification Team
stack from 5.0.38BK on linux
Attachment: linux.stack.txt (text/plain), 3.64 KiB.
[4 Mar 2007 6:37]
MySQL Verification Team
5.1.17BK stack
Attachment: linux.stack.5.1.17.txt (text/plain), 2.14 KiB.
[4 Mar 2007 8:01]
Valeriy Kravchuk
Thank you for a bug report. Verified just as described. 5.0.38-BK non-debug does not crash, while 5.1.17-BK crashed even without --with-debug on Linux: openxs@suse:~/dbs/5.1> bin/mysql -uroot test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.1.17-beta Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> drop table if exists `t1`; Query OK, 0 rows affected (0.01 sec) mysql> create table `t1` (`a` int,key (`a`)) engine=innodb; Query OK, 0 rows affected (0.01 sec) mysql> select 1 from ( select sum(`a`) from `t1` group by `a` with rollup) as ` a`; Empty set (0.00 sec) mysql> Number of processes running now: 0 070304 06:51:08 mysqld restarted Resolved stack trace: openxs@suse:~/dbs/5.1> bin/resolve_stack_dump -s /tmp/mysqld51.sym -n 26830.sta ck 0x82087bd handle_segfault + 605 (nil) 0x821dd9c _Z11mysql_parseP3THDPcj + 540 0x821ecb2 _Z16dispatch_command19enum_server_commandP3THDPcj + 3682 0x821f6e6 _Z10do_commandP3THD + 150 0x820dd03 handle_one_connection + 387 0x40047aa7 _end + 931979059 0x4023ec2e _end + 934039738
[10 Mar 2007 9:47]
Igor Babaev
The bug can be demonstrated with on a MyISAM table as well: mysql> CREATE TABLE t1 (a int, KEY (a)); Query OK, 0 rows affected (0.45 sec) mysql> INSERT INTO t1 VALUES (3), (1), (4), (1), (3), (1), (1); Query OK, 7 rows affected (0.00 sec) Records: 7 Duplicates: 0 Warnings: 0 mysql> SELECT * FROM (SELECT a, SUM(a) FROM t1 GROUP BY a WITH ROLLUP) as t; ERROR 2013 (HY000): Lost connection to MySQL server during query On the server side we have: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1291916384 (LWP 2823)] 0x08277a10 in setup_sum_funcs (thd=0x8d32ae0, func_ptr=0x8d4e458) at sql_select.cc:14204 /home/igor/dev-opt/mysql-5.0-opt-bug26830/sql/sql_select.cc:14204:460327:beg:0x8277a10 The segfault happens the in the following function: static bool setup_sum_funcs(THD *thd, Item_sum **func_ptr) { Item_sum *func; DBUG_ENTER("setup_sum_funcs"); while ((func= *(func_ptr++))) // <- Segfault { if (func->setup(thd)) DBUG_RETURN(TRUE); } DBUG_RETURN(FALSE); }
[10 Mar 2007 11:03]
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/21673 ChangeSet@1.2472, 2007-03-10 02:47:47-08:00, igor@olga.mysql.com +3 -0 Fixed bug #26830: a crash for the query with a subselect containing ROLLUP. Crash happened because the function get_best_group_min_max detected joins with ROLLUP incorrectly.
[12 Mar 2007 5:05]
Igor Babaev
Pushed to 5.0.38, 5.1.17
[15 Mar 2007 3:00]
Paul DuBois
Noted in 5.0.38, 5.1.17 changelogs. Use of a subquery containing GROUP BY and WITH ROLLUP caused a server crash.