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

Server crash in fk_prepare_copy_alter_table

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      --source include/have_innodb.inc
      create table t1(f1 int not null, f2 int not null, key(f1))engine=innodb;
      create table t2(f1 int not null, f2 int not null,
                      foreign key `f1` (f1) references t1(f1))engine=innodb;
      alter table t2 drop foreign key f1, drop foreign key f1, algorithm=copy;
      drop table t2, t1;
      

      Leads to:

      CS 10.6.26 1758b2578a8cc7e193bb35de0d8dc9a5e517c89c (Debug, Clang 18.1.3-11) Build 11/02/2026

      Core was generated by `/test/MD110226-mariadb-10.6.26-linux-x86_64-dbg/bin/mariadbd --no-defaults --ma'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x00005bbdab13c320 in fk_prepare_copy_alter_table (thd=0x72d228000d58, table=0x72d22802bae8, alter_info=0x72d330355198, alter_ctx=0x72d3303531f8)at /test/10.6_dbg/sql/sql_table.cc:9444
      9444	      if ((drop->type == Alter_drop::FOREIGN_KEY) &&
      [Current thread is 1 (LWP 1125077)]
      (gdb) bt
      #0  0x00005bbdab13c320 in fk_prepare_copy_alter_table (thd=0x72d228000d58, table=0x72d22802bae8, alter_info=0x72d330355198, alter_ctx=0x72d3303531f8)at /test/10.6_dbg/sql/sql_table.cc:9444
      #1  0x00005bbdab1342b6 in mysql_alter_table (thd=0x72d228000d58, new_db=0x72d228005800, new_name=0x72d228005c70, create_info=0x72d330355308, table_list=0x72d228013498, recreate_info=0x72d330354a08, alter_info=0x72d330355198, order_num=0, order=0x0, ignore=false, if_exists=false)at /test/10.6_dbg/sql/sql_table.cc:10876
      #2  0x00005bbdab1ee746 in Sql_cmd_alter_table::execute (this=0x72d228013bf8, thd=0x72d228000d58) at /test/10.6_dbg/sql/sql_alter.cc:675
      #3  0x00005bbdab03833b in mysql_execute_command (thd=0x72d228000d58, is_called_from_prepared_stmt=false) at /test/10.6_dbg/sql/sql_parse.cc:6168
      #4  0x00005bbdab026134 in mysql_parse (thd=0x72d228000d58, rawbuf=0x72d228013360 "alter table t2 drop foreign key f1, drop foreign key f1, algorithm=copy", length=71, parser_state=0x72d330356a48)at /test/10.6_dbg/sql/sql_parse.cc:8201
      #5  0x00005bbdab0235d9 in dispatch_command (command=COM_QUERY, thd=0x72d228000d58, packet=0x72d22800ade9 "alter table t2 drop foreign key f1, drop foreign key f1, algorithm=copy", packet_length=71, blocking=true)at /test/10.6_dbg/sql/sql_parse.cc:1911
      #6  0x00005bbdab026ce3 in do_command (thd=0x72d228000d58, blocking=true)at /test/10.6_dbg/sql/sql_parse.cc:1421
      #7  0x00005bbdab1e3de9 in do_handle_one_connection (connect=0x5bbdbbcac348, put_in_cache=true) at /test/10.6_dbg/sql/sql_connect.cc:1386
      #8  0x00005bbdab1e3b82 in handle_one_connection (arg=0x5bbdbbc66098)at /test/10.6_dbg/sql/sql_connect.cc:1298
      #9  0x000072d332c9caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #10 0x000072d332d29c6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  110226  1758b2578a8cc7e193bb35de0d8dc9a5e517c89c  SIGSEGV|fk_prepare_copy_alter_table|mysql_alter_table|Sql_cmd_alter_table::execute|mysql_execute_command
      CS  10.6   opt  110226  1758b2578a8cc7e193bb35de0d8dc9a5e517c89c  No bug found                  
      CS  10.11  dbg  110226  67fceadfa45b3f14921114544734455ecbdd480e  No bug found                  
      CS  10.11  opt  110226  67fceadfa45b3f14921114544734455ecbdd480e  No bug found                  
      CS  11.4   dbg  110226  78201a41b5e88b94c27f5ecc16c9e5486e2e50c3  No bug found                  
      CS  11.4   opt  110226  78201a41b5e88b94c27f5ecc16c9e5486e2e50c3  No bug found                  
      CS  11.8   dbg  110226  65ee9a7b4694d1b6f366b5a7a3d1b0549e5a3671  No bug found                  
      CS  11.8   opt  110226  65ee9a7b4694d1b6f366b5a7a3d1b0549e5a3671  No bug found                  
      CS  12.2   dbg  110226  d26a6f44c1f2119377e79a9540886c6d8c01472f  No bug found                  
      CS  12.2   opt  110226  d26a6f44c1f2119377e79a9540886c6d8c01472f  No bug found                  
      CS  12.3   dbg  110226  21a0714a118614982d20bfa504763d7247800091  No bug found                  
      CS  12.3   opt  110226  21a0714a118614982d20bfa504763d7247800091  No bug found                  
      ES  10.6   dbg  110226  22e626b9c17e9969925c54f14d30e39e25320b22  No bug found                  
      ES  10.6   opt  110226  22e626b9c17e9969925c54f14d30e39e25320b22  No bug found                  
      ES  11.4   dbg  110226  34f616d5fd2c649d0c79acb4e2423c90b8f10436  No bug found                  
      ES  11.4   opt  110226  34f616d5fd2c649d0c79acb4e2423c90b8f10436  No bug found                  
      ES  11.8   dbg  110226  405ee76b60c4ab82155f339136ed20d3b7363717  No bug found                  
      ES  11.8   opt  110226  405ee76b60c4ab82155f339136ed20d3b7363717  No bug found                  
      

      Attachments

        Activity

          People

            thiru Thirunarayanan Balathandayuthapani
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.