SELECT DISTINCT x...ORDER BY y LIMIT N,N crashes server
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.5 |
Invalid
|
Undecided
|
Unassigned | |||
5.6 |
Invalid
|
Undecided
|
Unassigned | |||
5.7 |
Fix Released
|
High
|
Laurynas Biveinis |
Bug Description
Running simple query leads to server crash:
CREATE TABLE `audits` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(255) DEFAULT NULL,
`item_id` int(11) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`action` varchar(255) DEFAULT NULL,
`item_
`reviewed_by` varchar(255) DEFAULT NULL,
`reviewed_at` datetime DEFAULT NULL,
`hide_in_history` tinyint(1) DEFAULT '0',
`accepted` tinyint(1) DEFAULT NULL,
`type_id` int(11) DEFAULT NULL,
`locale` varchar(255) DEFAULT 'nl',
`sub_item_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `index_
KEY `on_reviewed_by` (`reviewed_by`),
KEY `index_
KEY `index_
KEY `idx_on_
) ENGINE=InnoDB AUTO_INCREMENT=
SOURCE /tmp/audits.dump; -- available on request from devs
SET sql_mode='';
SELECT distinct audits.item_id FROM `audits` WHERE (audits.reviewed_by is null and audits.type_id = 233 and audits.user = 'UserName') ORDER BY audits.created_at desc LIMIT 0, 10;
ERROR 2013 (HY000): Lost connection to MySQL server during query
○ → resolve_stack_dump -s /tmp/mysqld.symbols -n /tmp/mysql.stack | c++filt
0xfe8b2e my_print_stacktrace + 46
0x9420b1 handle_fatal_signal + 1185
0x7f2e36fe3330 _end + 889345552
0xde0623 test_if_
0xde5e99 JOIN::optimize_
0xdeced5 JOIN::optimize() + 6309
0xe2945a st_select_
0xe29625 handle_query(THD*, LEX*, Query_result*, unsigned long long, unsigned long long) + 357
0x909984 execute_
0xdf4210 mysql_execute_
0xdf6a35 mysql_parse(THD*, Parser_state*) + 1493
0xdf7cf1 dispatch_
0xdf84bd do_command(THD*) + 461
0xeacf4c handle_connection + 684
0x1017aa4 pfs_spawn_thread + 436
0x7f2e36fdb184 _end + 889312356
0x7f2e3524237d _end + 858277469
If we remove the LIMIT or use GROUP BY audits.item_id instead of DISTINCT, then the crash does not happen. This is a Percona Server 5.7 only, upstream 5.7 is not affected and Percona Server 5.6 is not affected.
I did found other bugs related to test_if_
https:/
https:/
Changed in percona-server: | |
status: | New → Confirmed |
description: | updated |
tags: | added: regression |
Reduced test case uploaded to internal ticket