Bug #37627 | Killing query with sum(exists()) or avg(exists()) reproducibly crashes server | ||
---|---|---|---|
Submitted: | 25 Jun 2008 11:44 | Modified: | 24 Jul 2008 1:16 |
Reporter: | Randall Farmer | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: General | Severity: | S3 (Non-critical) |
Version: | 5.1.22-rc-community x86_64, 5.1 BZR | OS: | Any |
Assigned to: | Georgi Kodinov | CPU Architecture: | Any |
Tags: | avg, crash, DoS, KILL, subquery, sum |
[25 Jun 2008 11:44]
Randall Farmer
[25 Jun 2008 12:27]
Sveta Smirnova
Thank you for the report. But version 5.1.22 is a bit old. Please upgrade to current version 5.1.25, try with it and inform us if problem still exists.
[25 Jun 2008 12:40]
MySQL Verification Team
crashed my 5.1.26 ..
[25 Jun 2008 12:42]
MySQL Verification Team
my testcase: drop table if exists t1; create table t1(id int)engine=myisam; insert into t1 values (1),(2),(3),(4); insert into t1 select a.id from t1 a,t1 b,t1 c,t1 d; insert into t1 select a.id from t1 a,t1 b,t1 c; select sum(exists(select rand() from t1)) from t1; wait between 1 and 5 second then kill it from another session. try it multiple times, it's obviously timing problem. stack trace from 5.1.26: mysqld.exe!decimal_add()[decimal.c:1948] mysqld.exe!my_decimal_add()[my_decimal.h:363] mysqld.exe!Item_sum_sum::add()[item_sum.cc:808] mysqld.exe!update_sum_func()[sql_select.cc:15234] mysqld.exe!end_send_group()[sql_select.cc:12064] mysqld.exe!evaluate_join_record()[sql_select.cc:11159] mysqld.exe!sub_select()[sql_select.cc:11050] mysqld.exe!do_select()[sql_select.cc:10800] mysqld.exe!JOIN::exec()[sql_select.cc:2179] mysqld.exe!mysql_select()[sql_select.cc:2360] mysqld.exe!handle_select()[sql_select.cc:269] mysqld.exe!execute_sqlcom_select()[sql_parse.cc:4765] mysqld.exe!mysql_execute_command()[sql_parse.cc:2073] mysqld.exe!mysql_parse()[sql_parse.cc:5649] mysqld.exe!dispatch_command()[sql_parse.cc:1139] mysqld.exe!do_command()[sql_parse.cc:794] mysqld.exe!handle_one_connection()[sql_connect.cc:1115] mysqld.exe!pthread_start()[my_winthread.c:85] mysqld.exe!_callthreadstart()[thread.c:293]
[25 Jun 2008 13:32]
Sveta Smirnova
Shane, thank you for the feedback. Verified as described.
[4 Jul 2008 13: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/49013 2686 Georgi Kodinov 2008-07-04 Bug#37627: Killing query with sum(exists()) or avg(exists()) reproducibly crashes server On error executing an IN Subquery Item_in_exists::val_str and Item_in_exists::val_decimal were returning a NULL pointer without setting the NULL flag. Since IN subquery predicates are not supposed to return NULL values we must return 0 in such cases (and count on the subquery code actually setting the error).
[4 Jul 2008 14:02]
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/49016 2686 Georgi Kodinov 2008-07-04 Bug#37627: Killing query with sum(exists()) or avg(exists()) reproducibly crashes server When there is an error executing EXISTS predicates they return NULL as their string or decimal value but don't set the NULL value flag. Fixed by returning 0 (as a decimal or a string) on error exectuting the subquery. Note that we can't return NULL as EXISTS is not supposed to return NULL.
[4 Jul 2008 15:16]
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/49020 2687 Georgi Kodinov 2008-07-04 [merge] atutomatic merge of 5.1-bugteam into bug37627
[4 Jul 2008 15:17]
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/49021 2687 Georgi Kodinov 2008-07-04 [merge] atutomatic merge of 5.1-bugteam into bug37627
[4 Jul 2008 19: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/49032 2696 Chad MILLER 2008-07-04 [merge] Merge from 5.1. Add files new to 6.0.
[7 Jul 2008 8:44]
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/49064 2689 Georgi Kodinov 2008-07-07 Bug#37627: addendum : - moved the test into a separate file to check for presence of the test variable
[7 Jul 2008 8:46]
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/49065 2689 Georgi Kodinov 2008-07-07 Bug#37627: addendum : - moved the test into a separate file to check for presence of the test variable
[7 Jul 2008 9:02]
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/49067 2697 Georgi Kodinov 2008-07-07 [merge] merge of the addendum fix for bug 37627 5.1-bugteam->6.0-bugteam
[7 Jul 2008 9: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/49068 2697 Georgi Kodinov 2008-07-07 [merge] merge of the addendum fix for bug 37627 5.1-bugteam->6.0-bugteam
[16 Jul 2008 21: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/49893 2718 Andrei Elkin 2008-07-16 [merge] merging with 6.0-merge-rpl
[17 Jul 2008 10: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/49907 2718 Andrei Elkin 2008-07-16 [merge] merging with 6.0-merge-rpl
[23 Jul 2008 9:09]
Georgi Kodinov
Pushed in 5.1.28 and 6.0.7-alpha
[24 Jul 2008 1:16]
Paul DuBois
Noted in 5.1.28, 6.0.7 changelogs. Killing a query that used an EXISTS subquery as the argument to SUM() or AVG() caused a server crash.
[28 Jul 2008 16:47]
Bugs System
Pushed into 5.1.28 (revid:joerg@mysql.com-20080714105031-88hmr2baz5di9xej) (version source revid:joerg@mysql.com-20080714105031-88hmr2baz5di9xej) (pib:3)