[MDEV-13748] Assertion `status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory' failed in virtual THD::~THD after query with INTERSECT Created: 2017-09-06  Updated: 2020-09-17  Resolved: 2018-02-14

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.3
Fix Version/s: 5.5.60, 10.0.35, 10.1.32, 10.2.14, 10.3.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-10543 Memory leak when "replacing into" on ... Closed

 Description   

CREATE TABLE t1 (i INT, c VARCHAR(2), d1 DATETIME, d2 DATETIME) ENGINE=MyISAM;
INSERT INTO t1 VALUES 
(50,'xx','2021-08-24 00:00:00','0000-00-00 00:00:00'),
(51,'xx','2021-02-27 00:00:00','0000-00-00 00:00:00');
 
CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM;
INSERT INTO t2 VALUES 
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
(11),(12),(13),(14),(15),(16),(17),(18),(19),(20),
(21),(22),(23),(24),(25),(26),(27),(28),(29),(30),
(31),(32),(33),(34),(35),(36),(37),(38),(39),(40),
(41),(42),(43),(44),(45),(46),(47),(48),(49);
 
( SELECT GROUP_CONCAT( d1, d2 SEPARATOR '___' ) AS gc, c FROM t1 LEFT JOIN t2 ON (pk < i) GROUP BY c )
INTERSECT
( SELECT GROUP_CONCAT( d1, d2 SEPARATOR '___' ) AS gc, c FROM t1 LEFT JOIN t2 ON (pk < i) GROUP BY c )
;

10.3 016c35a7f2f4a

mysqld: /data/src/10.3/sql/sql_class.cc:1689: virtual THD::~THD(): Assertion `status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory' failed.
2017-09-06 16:37:02 0 [Note] /data/bld/10.3/bin/mysqld (root[root] @ localhost [127.0.0.1]): Normal shutdown
 
170906 16:37:02 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f293e9acee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x0000557d7b0717bb in THD::~THD (this=0x7f2928000b00, __in_chrg=<optimized out>) at /data/src/10.3/sql/sql_class.cc:1688
#9  0x0000557d7b071b16 in THD::~THD (this=0x7f2928000b00, __in_chrg=<optimized out>) at /data/src/10.3/sql/sql_class.cc:1695
#10 0x0000557d7afd69a6 in one_thread_per_connection_end (thd=0x7f2928000b00, put_in_cache=true) at /data/src/10.3/sql/mysqld.cc:3056
#11 0x0000557d7b21872f in do_handle_one_connection (connect=0x557d7d73c4f0) at /data/src/10.3/sql/sql_connect.cc:1437
#12 0x0000557d7b2183d3 in handle_one_connection (arg=0x557d7d73c4f0) at /data/src/10.3/sql/sql_connect.cc:1324
#13 0x0000557d7b6901dc in pfs_spawn_thread (arg=0x557d7d7dcef0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
#14 0x00007f29408f1494 in start_thread (arg=0x7f2938c44700) at pthread_create.c:333
#15 0x00007f293ea6993f in clone () from /lib/x86_64-linux-gnu/libc.so.6



 Comments   
Comment by Sergei Golubchik [ 2018-02-14 ]

With --debug_assert_on_not_freed_memory=0 safemalloc prints two leaks with stack traces.

Generated at Thu Feb 08 08:08:03 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.