[MDEV-22381] SIGSEGV in mysql_alter_table on ALTER on Aria table on optimized builds Created: 2020-04-28  Updated: 2020-04-28  Resolved: 2020-04-28

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Vladislav Lesin
Resolution: Duplicate Votes: 0
Labels: not-10.1

Issue Links:
Duplicate
duplicates MDEV-18042 Server crashes in mysql_alter_table u... Closed

 Description   

USE test;
SET @@SESSION.sql_mode=TRADITIONAL;
CREATE TABLE t (id INT) ENGINE=Aria;
ALTER TABLE t ADD COLUMN c DATETIME NOT NULL,ALGORITHM=INPLACE;

Leads to:

10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

Core was generated by `/test/MD210420-mariadb-10.5.3-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x7f02dad18700 (LWP 596821))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055c89c69b03d in my_write_core (sig=sig@entry=11) at /test/10.5_dbg/mysys/stacktrace.c:518
#2  0x000055c89be40d7b in handle_fatal_signal (sig=11) at /test/10.5_dbg/sql/signal_handler.cc:329
#3  <signal handler called>
#4  0x000055c89bc6fe48 in mysql_alter_table (thd=thd@entry=0x7f02ad415088, new_db=new_db@entry=0x7f02ad419940, new_name=new_name@entry=0x7f02ad419d48, create_info=create_info@entry=0x7f02dad162b0, table_list=<optimized out>, table_list@entry=0x7f02ad4741c8, alter_info=alter_info@entry=0x7f02dad161e0, order_num=0, order=0x0, ignore=false, if_exists=false) at /test/10.5_dbg/sql/sql_table.cc:10864
#5  0x000055c89bcf0f31 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x7f02ad415088) at /test/10.5_dbg/sql/sql_alter.cc:520
#6  0x000055c89bb9c422 in mysql_execute_command (thd=thd@entry=0x7f02ad415088) at /test/10.5_dbg/sql/sql_parse.cc:5912
#7  0x000055c89bba3f2b in mysql_parse (thd=thd@entry=0x7f02ad415088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f02dad17450, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7957
#8  0x000055c89bb8fc45 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f02ad415088, packet=packet@entry=0x7f02ad467089 "ALTER TABLE t ADD COLUMN c DATETIME NOT NULL,ALGORITHM=INPLACE", packet_length=packet_length@entry=62, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1839
#9  0x000055c89bb8e49b in do_command (thd=0x7f02ad415088) at /test/10.5_dbg/sql/sql_parse.cc:1358
#10 0x000055c89bce9415 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7f02b8fc53a8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1422
#11 0x000055c89bce9744 in handle_one_connection (arg=arg@entry=0x7f02b8fc53a8) at /test/10.5_dbg/sql/sql_connect.cc:1319
#12 0x000055c89c149fb0 in pfs_spawn_thread (arg=0x7f02d8845b08) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#13 0x00007f02da13f6db in start_thread (arg=0x7f02dad18700) at pthread_create.c:463
#14 0x00007f02d953d88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (dbg), 10.4.13 (opt), 10.5.2 (dbg), 10.5.2 (opt), 10.5.3 (dbg), 10.5.3 (opt)

Bug confirmed not present in:
MariaDB: 10.1.45 (dbg), 10.1.45 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)



 Comments   
Comment by Roel Van de Paar [ 2020-04-28 ]

All these items are required;
1) DATETIME; when changing to INT, the output is: 'ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY'
2) NOT NULL; when removing it, the output is: 'ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY'
3) ,ALGORITHM=INPLACE; when removing it, the output is: 'Query OK, 0 rows affected (0.023 sec)'

So it seems to be a non-covered situation when there is the combination of these items.

Comment by Elena Stepanova [ 2020-04-28 ]

This is a duplicate of MDEV-18042, with an identical stack trace and test case (except that TRADITIONAL is not resolved here).
Unrelated to Aria.

Comment by Roel Van de Paar [ 2020-04-28 ]

Agreed, duplicate of MDEV-18042. I did not find that one previously when searching.

Further findings;

  • Testcase does not crash when engine changed to InnoDB
  • Testcase does crash when engine changed to MyISAM or MEMORY
Generated at Thu Feb 08 09:14:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.