mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug #42419: Server crash with "Pure virtual method called" on two concurrent
connections The problem is that tables can enter open table cache for a thread without being properly cleaned up. This can happen if make_join_statistics() fails to read a const table because of e.g. a deadlock. It does set a member of TABLE structure to a value it allocates, but doesn't clean-up this setting on error nor does it set the rest of the members in JOIN to allow for automatic cleanup. As a result when such an error occurs and the next statement depends re-uses the table from the open tables cache it will get it with this TABLE::reginfo.join_tab pointing to a memory area that's freed. Fixed by making sure make_join_statistics() cleans up TABLE::reginfo.join_tab on error.
This commit is contained in:
@ -1267,4 +1267,20 @@ CREATE INDEX i1 on t1 (a(3));
|
||||
SELECT * FROM t1 WHERE a = 'abcde';
|
||||
a
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT)
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
|
||||
SET AUTOCOMMIT = 0;
|
||||
CREATE TEMPORARY TABLE t1_tmp (b INT);
|
||||
INSERT INTO t1_tmp SELECT b FROM t1 WHERE a = 3;
|
||||
INSERT INTO t1_tmp SELECT b FROM t1 WHERE a = 2;
|
||||
SET AUTOCOMMIT = 0;
|
||||
CREATE TEMPORARY TABLE t2_tmp ( a INT, new_a INT);
|
||||
INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
|
||||
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
|
||||
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
|
||||
INSERT INTO t1_tmp SELECT b FROM t1 WHERE a = 1;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user