Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-11605

Assertion `(longlong) thd->status_var.local_memory_used >= 0 || !debug_assert_on_not_freed_memory' failed in my_malloc_size_cb_func

    Details

      Description

      10.2 c35b8c46b404d035e54a23d667da5dff6502fc2e

      mysqld: /data/src/10.2/sql/mysqld.cc:4104: void my_malloc_size_cb_func(long long int, my_bool): Assertion `(longlong) thd->status_var.local_memory_used >= 0 || !debug_assert_on_not_freed_memory' failed.
      161219 16:34:27 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f55de4e8312 in __GI___assert_fail (assertion=0x7f55e0fa5578 "(longlong) thd->status_var.local_memory_used >= 0 || !debug_assert_on_not_freed_memory", file=0x7f55e0fa2484 "/data/src/10.2/sql/mysqld.cc", line=4104, function=0x7f55e0faada0 <my_malloc_size_cb_func::__PRETTY_FUNCTION__> "void my_malloc_size_cb_func(long long int, my_bool)") at assert.c:101
      #8  0x00007f55e05d1517 in my_malloc_size_cb_func (size=-7016996765293437281, is_thread_specific=<optimized out>) at /data/src/10.2/sql/mysqld.cc:4103
      #9  0x00007f55e0f1c245 in update_malloc_size (size=<optimized out>, is_thread_specific=<optimized out>) at /data/src/10.2/mysys/my_malloc.c:67
      #10 0x00007f55e0f1c2c2 in my_free (ptr=0x7f55d5617e70) at /data/src/10.2/mysys/my_malloc.c:215
      #11 0x00007f55e0eadb48 in mi_repair_by_sort (param=0x7f55d5620088, info=0x7f55d56a6070, name=0x7f55e168c680 "./test/#sql-37c4_3", rep_quick=1) at /data/src/10.2/storage/myisam/mi_check.c:2552
      #12 0x00007f55e0e9ff5a in ha_myisam::repair (this=this@entry=0x7f55d54b5888, thd=thd@entry=0x7f55d5416070, param=..., do_optimize=do_optimize@entry=false) at /data/src/10.2/storage/myisam/ha_myisam.cc:1218
      #13 0x00007f55e0ea0b17 in ha_myisam::enable_indexes (this=0x7f55d54b5888, mode=<optimized out>) at /data/src/10.2/storage/myisam/ha_myisam.cc:1549
      #14 0x00007f55e0e9c13c in ha_myisam::end_bulk_insert (this=0x7f55d54b5888) at /data/src/10.2/storage/myisam/ha_myisam.cc:1699
      #15 0x00007f55e072a055 in ha_end_bulk_insert (this=0x7f55d54b5888) at /data/src/10.2/sql/handler.h:2874
      #16 copy_data_between_tables (alter_ctx=0x7f55e168db10, keys_onoff=<optimized out>, deleted=<synthetic pointer>, copied=<synthetic pointer>, order=<optimized out>, order_num=0, ignore=<optimized out>, create=..., to=0x7f55d54d7070, from=0x7f55d54d5870, thd=0x7f55d5416070) at /data/src/10.2/sql/sql_table.cc:9916
      #17 mysql_alter_table (thd=thd@entry=0x7f55d5416070, new_db=<optimized out>, new_name=<optimized out>, create_info=create_info@entry=0x7f55e168e710, table_list=table_list@entry=0x7f55d5464190, alter_info=alter_info@entry=0x7f55e168e660, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9349
      #18 0x00007f55e07848f9 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x7f55d5416070) at /data/src/10.2/sql/sql_alter.cc:324
      #19 0x00007f55e068c92b in mysql_execute_command (thd=thd@entry=0x7f55d5416070) at /data/src/10.2/sql/sql_parse.cc:6116
      #20 0x00007f55e068e2d2 in mysql_parse (thd=thd@entry=0x7f55d5416070, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f55e16908e0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.2/sql/sql_parse.cc:7790
      #21 0x00007f55e069055b in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f55d5416070, packet=packet@entry=0x7f55d5458071 "ALTER TABLE t4 ADD INDEX(vcol_varchar(64))", packet_length=packet_length@entry=42, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.2/sql/sql_parse.cc:1799
      #22 0x00007f55e069308d in do_command (thd=0x7f55d5416070) at /data/src/10.2/sql/sql_parse.cc:1359
      #23 0x00007f55e0780f4a in do_handle_one_connection (connect=connect@entry=0x7f55dd871410) at /data/src/10.2/sql/sql_connect.cc:1354
      #24 0x00007f55e0781133 in handle_one_connection (arg=arg@entry=0x7f55dd871410) at /data/src/10.2/sql/sql_connect.cc:1260
      #25 0x00007f55e0a2f1bf in pfs_spawn_thread (arg=0x7f55dd815df0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #26 0x00007f55dfd820a4 in start_thread (arg=0x7f55e1692300) at pthread_create.c:309
      #27 0x00007f55de5a287d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      CREATE TABLE t4 ( 
       pk BIGINT AUTO_INCREMENT,
       col_int SMALLINT(48) NOT NULL DEFAULT 0,
       col_datetime DATETIME(6) NULL,
       col_enum SET('','a','b','c','d','e','f','foo','bar') NULL,
       col_dec DECIMAL(65,38) UNSIGNED ZEROFILL NULL,
       col_bit BIT(26) NULL,
       col_year YEAR NULL,
       col_datetime2 DATETIME(6) NULL,
       col_date DATE NULL,
       col_char BINARY(242) NOT NULL DEFAULT '',
       col_time TIME(1) NULL,
       col_blob TINYTEXT NULL,
       col_varchar VARCHAR(1855) NOT NULL DEFAULT '',
       vcol_varchar VARCHAR(2116) AS (col_varchar) VIRTUAL,
       PRIMARY KEY(pk)
       ) ENGINE=MyISAM;
       
      INSERT INTO t4 (col_int,col_datetime,col_enum,col_dec,col_bit,col_year,col_datetime2,col_date,col_char,col_time,col_blob,col_varchar) VALUES
       (9,NULL,'',0.2,b'10100001',2026,NULL,'1988-08-27','bar','14:20:46.009603','bar','bar'),
       (6,'2013-06-27 15:21:27.016500','',0.1,b'01000100',1983,'2014-03-26 03:00:53.052916','2000-09-04','','22:30:46.061648','bar','bar'),
       (156,'2017-04-04 00:00:00','',0.8,NULL,1992,'1991-10-18 17:41:54.030689',NULL,'f','16:58:37.037585','z','a'),
       (7,'1979-05-14 19:13:18.060777',NULL,0.4,b'0',1994,'1900-01-01 00:00:00','2030-01-06','bar','03:24:01.010412','bar','bar'),
       (5,'1975-08-06 00:00:02.061160','',0.7,b'01',1996,'1982-06-10 13:09:15.005717','2008-04-23','bar',NULL,'bar','bar'),
       (14,'2029-05-19 07:56:57.028948','',0.0,NULL,1973,'1900-01-01 00:00:00','2006-03-01','p','20:58:23.064148','v','a'),
       (23,NULL,'',NULL,b'011111111000',2014,'2004-06-19 17:20:37.029214','1974-06-26','bar','14:55:15.000814','m','bar'),
       (6,NULL,'',0.6,b'1100100011011101001111',1986,'2014-07-01 03:01:16.043826','2020-01-15','z','04:57:32.018208','bar','g'),
       (2,'1987-03-12 05:18:40.006865','',0.6,b'001001001011000011001',2012,NULL,'2020-04-21','','20:45:31.021923','k','t'),
       (1,'1993-05-23 10:37:22.054985','',0.4,b'01001',NULL,'1997-08-16 02:35:53.002484','2001-12-09','bar','07:36:35.044493','','s'),
       (9,'2020-11-17 01:09:54.053312','',0.7,b'0',2022,'1900-01-01 00:00:00','2026-05-12','bar','21:41:10.040515','bar','bar'),
       (1,'2025-04-21 16:08:16.033559','',0.4,b'0000',1991,'2013-03-14 09:03:02.016013',NULL,'bar','23:22:08.056231','c','bar'),
       (4,NULL,'',0.5,b'101000000',2023,'1900-01-01 00:00:00','1991-05-26','bar','08:23:51.037917','bar',''),
       (5,'2035-09-13 00:00:00','',0.4,b'1110100001001111',2027,'2001-01-13 19:20:36.044577','2019-04-03','foo','08:18:11.001097','','bar'),
       (6,'1975-08-15 21:42:22.049174','',0.3,b'010010010101',2032,NULL,'2023-01-21','bar','22:08:23.001364','bar','bar'),
       (4,'2013-05-01 00:00:00','',0.3,b'011101010000110000',2021,'2030-07-16 00:00:00','2027-12-07','e','10:09:49.061627','bar','bar'),
       (2,'2035-06-20 22:55:45.008894','',0.8,b'11000',2034,'1983-12-20 07:27:43.035034','1986-09-12','bar','19:02:29.013068','bar','foo'),
       (0,NULL,'',0.1,b'01111010100011',2029,'1978-01-08 00:00:00','1974-12-16','','03:44:02.034839','bar','foo'),
       (1,'1983-11-04 19:04:57.035319','',0.8,b'100001110100110001010',2001,NULL,'1981-05-05','f','00:00:00','bar','bar'),
       (5,NULL,'',0.7,b'0011110001101',NULL,NULL,'1999-07-28','bar','20:33:42.039257','x','r'),
       (3,NULL,'',0.9,b'00110110111',2019,'2008-12-27 00:00:00','2012-03-14','bar','19:12:32.062124','bar','bar'),
       (8,NULL,'',0.9,b'001011001111',1977,'1995-02-20 00:00:00','1985-02-04','bar','23:08:10.014396','bar','bar'),
       (0,NULL,NULL,0.9,b'01',2001,'2011-03-16 22:54:22.026461',NULL,'foo','07:07:55.017714','z','m'),
       (8,'2027-08-03 00:00:00','',0.2,b'110001',2035,'2011-06-24 15:58:37.049649','2028-11-21','qux','16:37:54.001939','d','f'),
       (2,'1900-01-01 00:00:00','',0.1,b'10',2015,'1973-11-22 15:34:01.047131','2010-08-18','foo','17:43:20.056086','bar','b'),
       (7,NULL,'',0.7,b'00100100',1974,'1983-04-16 15:00:17.003592',NULL,'qux','00:00:00','bar','foo'),
       (7,'1980-05-10 20:47:46.049712','',0.0,NULL,2010,'1900-01-01 00:00:00','1974-06-01','foo','08:34:02.056752','bar','qux'),
       (0,'2029-01-10 19:49:58.002777',NULL,0.4,b'1100',2026,'2007-11-24 04:06:32.038008','1980-02-20','foo','06:01:30.019582','qux','bar'),
       (8,'2010-01-04 12:54:59.003789','',0.8,b'01001110111010111',1971,'2010-01-17 06:56:30.006700','2007-09-21','u','13:31:53.061759','bar','foo'),
       (1,'1976-11-17 00:00:00','',0.0,b'00010001011101',2034,'1976-11-08 21:18:21.053929','2029-04-19','','00:38:43.046200','qux','bar'),
       (4,'1991-06-12 16:01:19.007026','',0.4,b'110111010100101111011001',1997,'2004-03-07 18:06:41.050645',NULL,'','17:23:17.056960','o',''),
       (4,'2021-12-14 20:59:31.062969',NULL,0.8,b'01100001010111011101000101',NULL,'2034-04-17 02:55:45.046064',NULL,'bar','10:28:15.003445','n','foo'),
       (85,'1998-09-24 21:01:37.043422','',0.3,b'1001001001111010',1997,'2033-03-23 12:54:48.043906','2030-10-10','r','08:12:29.026018','d','foo'),
       (5,'2031-11-20 00:00:00','',0.1,b'11010011111',2011,'1989-07-07 16:45:29.060242',NULL,'qux','05:12:14.002326','foo','bar'),
       (9,'1900-01-01 00:00:00','',0.3,b'0100010',2035,'1900-01-01 00:00:00','1982-12-04','bar',NULL,NULL,'qux'),
       (8,'2024-11-03 23:31:40.058574','',0.2,b'11001101110101100100001011',2027,'1977-12-18 00:00:00','1972-01-13','tqvbj','16:27:36.004472','qux','f'),
       (1,'1976-01-06 23:32:58.038263','',0.6,NULL,2020,'2029-03-08 18:36:33.010902','1900-01-01','qux','19:36:37.015269','e','bar'),
       (9,'1900-01-01 00:00:00','',0.1,b'010010111101111110000',1993,'2000-10-27 16:52:51.015854','1974-12-22','qux','05:46:08.055789','i','bar'),
       (6,'1900-01-01 00:00:00','',0.0,b'00',2010,'2009-06-09 18:30:10.054617',NULL,'qux','01:36:44.033940','bar',''),
       (6,'2006-04-13 05:21:03.061942','',0.0,b'0000101101100011010000111',1971,'2032-04-05 16:01:44.056007',NULL,'r','01:08:36.007948',NULL,'bar'),
       (8,'2001-03-27 10:39:48.064273','',0.2,b'1000111100100100110',2021,'2016-11-21 07:09:28.035220','2020-01-08','qux','21:33:51.036722','','bar'),
       (6,'2009-11-26 00:00:00','',0.0,b'0000110010001010110111',2009,'2034-02-16 11:01:29.027539','2009-04-12','q','12:01:56.032072','bar','qux'),
       (2,'1990-03-12 07:26:22.053357','',0.7,b'0110',2002,'1975-12-13 03:14:35.064214','2015-05-04','foo','18:17:43.065361','qux','bar'),
       (3,'1900-01-01 00:00:00','',0.8,b'0',1990,'2004-03-24 17:19:30.055335','2005-01-21','bar','07:08:14.014929','b','b'),
       (7,'2012-12-18 00:00:00','',0.5,NULL,1981,'1981-02-17 15:47:55.041049','1989-09-26','bar','09:00:19.031063','t','foo'),
       (3,'1981-12-09 10:10:34.008107','',0.8,NULL,1976,NULL,'1980-01-20','foo','00:00:00','qux','bar'),
       (2,'2006-06-05 03:56:10.030366','',0.5,b'001000101000100000100',1996,'1998-08-17 00:00:00','1994-02-11','bar','20:55:21.044208',NULL,'foo'),
       (4,'1900-01-01 00:00:00',NULL,0.4,b'00111000011000001010000',1980,NULL,NULL,'e','09:37:44.034108','','k'),
       (2,'2018-03-01 21:14:08.062101','',0.2,b'00001101011101000',1985,'2022-06-09 17:17:31.039498','1900-01-01','bar','00:00:00','j','qux'),
       (1,'2018-05-06 20:12:14.043515',NULL,NULL,b'1100100000100001101011',NULL,'2020-12-20 11:46:57.017685','1973-04-20','qux','00:00:00','','bar'),
       (8,'1985-07-12 02:16:53.034909',NULL,0.3,b'10111000100110110101',1997,'1985-11-07 23:07:06.015091','2007-01-08','z','04:14:58.038324','bar','x'),
       (5,'2027-09-21 16:28:36.016865','',0.9,NULL,1986,'2013-11-16 07:22:14.009509','1900-01-01','qux','16:19:03.023217','bar','d'),
       (1,'1900-01-01 00:00:00','',0.5,b'010101',2007,'1987-03-23 01:34:02.040253','2004-01-24','bar','00:00:00','qux','t'),
       (0,NULL,'',0.3,b'10111010001110111011',2030,NULL,'2007-11-17','qux','14:16:15.008674','bar','foo'),
       (5,'1900-01-01 00:00:00','',0.3,b'1',2004,'1978-03-06 00:00:00','2003-07-08','','09:33:46.000325','','bar'),
       (207,'2019-10-05 19:24:40.063253','',NULL,b'1010111000110110110000',1977,'1992-01-07 15:50:41.043085','2003-10-24','d','12:50:19.026611','qux','bar'),
       (1,'2012-07-01 23:30:29.042644','',0.8,b'01111010111001001101',1974,'1976-03-16 00:00:00','2006-01-09','qux','22:22:44.040748','','bar'),
       (2,'1995-06-21 00:00:00','',0.9,b'000101001100100',2022,'2006-09-23 00:00:00',NULL,'bar','06:13:27.061694','v','qux'),
       (1,'1900-01-01 00:00:00',NULL,0.8,b'000000001000',2027,'2028-03-20 08:34:05.027629','1999-09-28','bar','01:39:33.047138','foo','qux'),
       (5,'1996-06-01 05:23:35.020694','',0.9,b'1111001111001110001011001',1996,'1973-12-13 05:51:14.039856','1993-04-13','','20:24:00.040657','foo','bar'),
       (8,'2000-02-18 12:32:03.020086','',0.3,b'0000111010',2010,'1972-09-12 01:43:50.058850',NULL,'qux','23:12:01.017030','bar','x'),
       (8,'1992-05-27 02:39:01.058236','',0.7,b'011101110',2032,NULL,'1998-04-03','h','12:22:12.041362','p','bar'),
       (7,'1900-01-01 00:00:00','',0.3,b'10111111110011010111',1989,'1998-06-08 00:00:00','1993-02-10','qux','12:44:43.060254','h','bar'),
       (164,'2034-08-09 10:48:51.053786',NULL,0.0,b'00100111',1973,'2026-01-13 19:29:43.039915','2022-03-01','bar','11:51:54.036462','','qux'),
       (0,'2030-02-22 18:02:11.043075','',0.8,b'011000111111011111111100',2001,'2030-02-09 15:46:56.055798','2026-03-20','bar','10:31:58.002654','q','qux'),
       (7,'2009-11-19 06:26:11.008028','',0.8,NULL,2004,'2009-07-05 00:00:00','2014-04-22','t','05:45:36.023615',NULL,'u'),
       (1,'1987-04-17 04:16:29.007028','',0.5,b'00',1976,'1900-01-01 00:00:00','2023-12-07','foo','22:25:07.010419','qux','bar'),
       (6,NULL,'',0.6,b'0',2003,'2025-04-15 11:19:34.034736','2010-06-20','qux','00:00:00','bar','foo'),
       (2,'2025-03-26 07:09:22.012297','',0.5,b'00110000001110111110',2033,'1974-03-16 18:35:58.062140','1982-04-07','qux','18:50:57.025695',NULL,'z'),
       (4,'2032-12-08 13:05:51.020675','',0.4,b'11001001100011',NULL,'1983-08-26 11:47:49.027635','2019-07-08','qux','00:00:00','','x'),
       (0,'1972-12-10 00:00:00','',NULL,b'00000100010110100000',1978,'1990-12-28 15:20:43.027572','2008-02-23','r','17:48:05.030363','foo','bar'),
       (6,'1900-01-01 00:00:00',NULL,0.9,b'111000001101010',2026,'1997-08-09 00:00:00','1900-01-01','c','00:00:00','','qux'),
       (6,NULL,'',0.5,b'011110001001',2010,'1900-01-01 00:00:00','2018-01-11','foo','00:00:00','qux','bar'),
       (9,'2000-11-10 06:31:29.024423','',0.7,NULL,2004,'1900-01-01 00:00:00','1972-04-10','qux','22:50:18.046302','foo','bar'),
       (0,'2008-02-11 00:00:00','',0.3,b'111010011',NULL,'1976-10-02 06:40:56.017017','1900-01-01','q','12:50:11.001180',NULL,'foo'),
       (6,'2032-01-13 00:00:00',NULL,0.7,b'0101110010010110011001000',2006,NULL,'2015-06-08','bar','00:27:52.030995','qux','foo'),
       (5,NULL,'',0.2,b'101100101000',1993,'2008-03-26 00:00:00','2023-03-25','bar','17:51:32.035040','foo','qux'),
       (0,NULL,NULL,NULL,b'01110000111011010101',2020,'1988-02-20 19:30:16.015815','2027-02-07','bar','11:18:36.020832','qux','foo'),
       (8,'1990-02-04 11:52:45.035803','',0.2,b'1',2034,'2014-06-28 16:58:27.046952','2020-12-05','bar','08:36:43.060728','','qux'),
       (1,NULL,'',0.7,b'110010010111110100110001',2002,'2019-06-19 03:39:03.040619','2001-08-28','bar','01:59:24.036052','foo','qux'),
       (6,'2003-09-12 14:34:37.035049','',0.3,b'110010',2029,NULL,'2025-11-09','bar','18:51:11.041328','d',''),
       (9,NULL,'',NULL,b'00010',2005,'2027-07-12 23:36:51.053942','2000-06-04','qux','13:46:39.062130','bar',''),
       (5,'2035-12-19 04:59:44.044122','',0.8,b'110011011010010101101100',2000,'1980-06-16 02:14:18.040078','1900-01-01','j',NULL,'qux','c'),
       (4,'1978-06-11 18:53:14.037991','',0.4,b'00000',NULL,'2018-03-13 18:56:39.056433','2020-12-07','foo','17:58:15.029684','bar','y'),
       (2,NULL,'',0.2,b'100101110010101',1976,'2017-06-12 18:40:22.011803','2021-11-01','qux','15:16:59.059052','foo','bar'),
       (5,'2017-08-07 01:53:34.056737','',0.1,b'1110101100',1979,'1900-01-01 00:00:00','1900-01-01','foo','03:13:31.046205','bar',REPEAT('a',1693)),
       (7,'2022-09-25 03:36:08.040842','',0.7,b'11010111110001010',2026,NULL,'2018-04-15','bar','16:08:47.004044','','qux'),
       (5,'1988-04-05 07:40:37.041464','',0.6,b'101110100110110',NULL,'2011-08-08 02:23:59.013723','2020-01-28','qux','00:00:00','foo','y'),
       (6,NULL,NULL,0.7,b'1100001',1995,NULL,'2026-02-01','',NULL,'o','qux'),
       (9,'1985-05-13 00:00:00','',0.5,b'1110101011010100101110',1973,'1975-04-08 00:00:00','2006-09-22','qux','13:43:19.008905','foo','bar'),
       (7,'2032-07-23 00:00:00','',0.6,b'10100100011110110100',1985,'1997-02-22 02:04:16.040238','1971-05-24','y','10:27:41.006741','i','qux'),
       (1,'1900-01-01 00:00:00','',0.5,NULL,2013,'2002-09-28 00:00:00','2025-03-17','o','13:27:32.040813','','y'),
       (8,'2014-08-03 10:02:33.055574','',0.0,b'1',1992,NULL,'1978-12-27','x','10:58:03.022898','foo',''),
       (9,'2011-05-25 00:00:00','',0.8,b'11001001000011100',2019,NULL,'2003-10-06','qux','00:00:00',NULL,'bar'),
       (8,'1900-01-01 00:00:00','',0.0,b'101101000010100011011111',2000,'2005-05-18 00:00:00','1995-07-13','bar','13:19:40.057958','foo',''),
       (4,NULL,'',0.8,b'011011',1972,NULL,'2008-04-16','b','00:00:00','bar','foo'),
       (8,'2005-07-21 07:54:38.040060','',0.5,b'100',2003,'1900-01-01 00:00:00','1994-09-03','qux','02:36:25.048212','','b'),
       (7,'2002-07-03 01:08:02.012450','',0.5,b'101100010001101101',1990,'1974-04-15 02:53:22.018939','2002-02-12','','10:40:14.031253','w','c'),
       (174,'2029-09-28 01:08:52.004131','',NULL,b'001001000011',1976,'2034-12-11 02:11:04.035857','2005-07-18','qux','00:00:00','xd','bar'),
       (255,'2004-02-02 06:53:55.023459',NULL,NULL,b'111010100',1982,'1983-12-17 00:00:00','2003-12-20','bar','01:23:47.001055','t','qux');
       
      ALTER TABLE t4 ADD INDEX(vcol_varchar(64));
      

      No crash on a non-debug build.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: