Bug #53544 | Server hangs during JOIN query in stored procedure called twice in a row | ||
---|---|---|---|
Submitted: | 10 May 2010 16:50 | Modified: | 22 Nov 2010 11:51 |
Reporter: | John Embretsen | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.1.47, 5.6.99-m4 Dahlia, bzr_mysql-6.0-codebase-bugfixing | OS: | Any |
Assigned to: | Alexey Kopytov | CPU Architecture: | Any |
Tags: | regression |
[10 May 2010 16:50]
John Embretsen
[10 May 2010 16:51]
John Embretsen
I expect to be able to provide more details and a simplified reproducible test case later.
[11 May 2010 18:42]
John Embretsen
The following SQL exhibits this behavior with current mysql-6.0-codebase-bugfixing as well as mysql-next-mr-opt-backporting: (it may be possible to simplify further) ------------------------------------- -- -- Create and populate tables -- DROP TABLE IF EXISTS `AA`; CREATE TABLE `AA` ( `col_int` int(11) DEFAULT NULL, `col_int_key` int(11) DEFAULT NULL, `pk` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`pk`), KEY `col_int_key` (`col_int_key`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; INSERT INTO `AA` VALUES (NULL,7,1),(8,3,2); DROP TABLE IF EXISTS `FF`; CREATE TABLE `FF` ( `pk` int(11) NOT NULL AUTO_INCREMENT, `col_int` int(11) DEFAULT NULL, `col_int_key` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `col_int_key` (`col_int_key`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; INSERT INTO `FF` VALUES (1,9,6),(2,8,NULL); DROP TABLE IF EXISTS `M`; CREATE TABLE `M` ( `pk` int(11) NOT NULL AUTO_INCREMENT, `col_int_key` int(11) DEFAULT NULL, `col_int` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `col_int_key` (`col_int_key`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; INSERT INTO `M` VALUES (1,9,8),(2,3,NULL); -- -- Create the stored procedure with the query. -- In this example the query itself returns no rows. -- DROP PROCEDURE IF EXISTS stored_proc_1; CREATE PROCEDURE stored_proc_1 () LANGUAGE SQL SELECT table2.`col_int` AS field1 FROM FF AS table1 LEFT JOIN M AS table2 ON table1.`pk` = table2.`col_int` RIGHT JOIN AA AS table3 ON table1.`col_int_key` = table3.`col_int_key` WHERE ( table3.`col_int_key` BETWEEN 1 AND 4 ) GROUP BY field1; -- -- Run the stored procedure. Hang occurs on second run. -- CALL stored_proc_1; CALL stored_proc_1;
[12 May 2010 8:40]
John Embretsen
Same hang also observed when using Prepared Statements instead of Stored Procedures.
[25 Aug 2010 9:40]
Alexey Kopytov
This is a regression introduced in 5.0.74 and 5.1.31 by the fix for bug #33811.
[8 Sep 2010 18:48]
Paul DuBois
Noted in 5.1.51, 5.5.6 changelogs. Queries with nested joins could cause an infinite loop in the server when used from stored procedures and prepared statements.
[28 Sep 2010 8:45]
Bugs System
Pushed into mysql-5.1 5.1.52 (revid:sunanda.menon@sun.com-20100928083322-wangbv97uobu7g66) (version source revid:sunanda.menon@sun.com-20100928083322-wangbv97uobu7g66) (merge vers: 5.1.52) (pib:21)
[14 Oct 2010 8:29]
Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.51-ndb-7.0.20 (revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (version source revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (merge vers: 5.1.51-ndb-7.0.20) (pib:21)
[14 Oct 2010 8:45]
Bugs System
Pushed into mysql-5.1-telco-6.3 5.1.51-ndb-6.3.39 (revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (version source revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (merge vers: 5.1.51-ndb-6.3.39) (pib:21)
[14 Oct 2010 8:59]
Bugs System
Pushed into mysql-5.1-telco-6.2 5.1.51-ndb-6.2.19 (revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (version source revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (merge vers: 5.1.51-ndb-6.2.19) (pib:21)
[14 Oct 2010 15:16]
Jon Stephens
Already documented in the 5.1.50 changelog; no new changelog entries required. setting back to Closed state.
[3 Nov 2010 19:50]
Paul DuBois
CVE-2010-3839
[3 Nov 2010 19:50]
Paul DuBois
CVE-2010-3839
[9 Nov 2010 19:44]
Bugs System
Pushed into mysql-5.5 5.5.7-rc (revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (version source revid:marko.makela@oracle.com-20100824081003-v4ecy0tga99cpxw2) (merge vers: 5.1.50) (pib:21)
[13 Nov 2010 16:18]
Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:marko.makela@oracle.com-20100824081003-v4ecy0tga99cpxw2) (merge vers: 5.1.50) (pib:21)
[13 Nov 2010 16:31]
Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:marko.makela@oracle.com-20100824081003-v4ecy0tga99cpxw2) (pib:21)