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

Crash while using foreign key on field of unsigned type (CONNECT engine)

Details

    Description

      Documentation says that foreign key is supported only by innodb, but no warnings if I use other engines. Server crash without anything in error log, when the field is defined as unsigned and as foreign key.

      CREATE TABLE t1 (id INT unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, m int) 
      ENGINE = InnoDB;
       
      CREATE TABLE t2 (
        id2 int NOT NULL PRIMARY KEY,
        t_id int  unsigned NOT NULL,
        FOREIGN KEY (t_id) REFERENCES t1 (id) ON DELETE CASCADE ON UPDATE RESTRICT
      ) ENGINE = connect;
       
      INSERT INTO t1 (m) VALUES ('1');
      INSERT INTO t2  VALUES (1, 5);
      

      Core dump:

      Program terminated with signal SIGSEGV, Segmentation fault.
       
      Thread 1 (Thread 0x7f0db4069700 (LWP 32610)):
      #0  __longjmp () at ../sysdeps/x86_64/__longjmp.S:67
      #1  0xedfb3167a7017b8d in ?? ()
      Backtrace stopped: Cannot access memory at address 0xedfb3167a7017b8d
      

      Attachments

        Activity

          Stacktrace:

          #0  __longjmp () at ../sysdeps/x86_64/__longjmp.S:45
          #1  0x00007ffff57cf289 in __libc_siglongjmp (env=0x7fffa4032c28, val=7) at longjmp.c:38
          #2  0x00007ffff013f793 in VALBLK::ChkTyp (this=0x7fff9c000180, v=0x7fff9bfffa60)
              at /home/vicentiu/Workspace/MariaDB/storage/connect/valblk.cpp:219
          #3  0x00007ffff0143f15 in TYPBLK<int>::SetValue (this=0x7fff9c000180, valp=0x7fff9bfffa60, n=0)
              at /home/vicentiu/Workspace/MariaDB/storage/connect/valblk.cpp:288
          #4  0x00007ffff015edd9 in KXYCOL::SetValue (this=0x7fff9c000048, colp=0x7fff9bfff9a0, i=0)
              at /home/vicentiu/Workspace/MariaDB/storage/connect/xindex.cpp:3178
          #5  0x00007ffff015e2ee in XINDEX::Make (this=0x7fff9bfffed0, g=0x7fffa40328b0, sxp=0x7fff9bfff318)
              at /home/vicentiu/Workspace/MariaDB/storage/connect/xindex.cpp:504
          #6  0x00007ffff01098e5 in TDBDOS::MakeIndex (this=0x7fff9bfff4e0, g=0x7fffa40328b0,
              pxdf=0x7fff9bfff318, add=false)
              at /home/vicentiu/Workspace/MariaDB/storage/connect/tabdos.cpp:1753
          #7  0x00007ffff0105b7a in TDBDOS::ResetTableOpt (this=0x7fff9bfff4e0, g=0x7fffa40328b0, dop=true,
              dox=true) at /home/vicentiu/Workspace/MariaDB/storage/connect/tabdos.cpp:611
          #8  0x00007ffff00bd724 in CntCloseTable (g=0x7fffa40328b0, tdbp=0x7fff9bfff4e0, nox=false,
              abort=false) at /home/vicentiu/Workspace/MariaDB/storage/connect/connect.cc:638
          #9  0x00007ffff00a554d in ha_connect::CloseTable (this=0x7fffa4030ac8, g=0x7fffa40328b0)
              at /home/vicentiu/Workspace/MariaDB/storage/connect/ha_connect.cc:1951
          #10 0x00007ffff00af08b in ha_connect::external_lock (this=0x7fffa4030ac8, thd=0x7fffa4000b00,
              lock_type=2) at /home/vicentiu/Workspace/MariaDB/storage/connect/ha_connect.cc:4633
          #11 0x00000000009d75ff in handler::ha_external_lock (this=0x7fffa4030ac8, thd=0x7fffa4000b00,
              lock_type=2) at /home/vicentiu/Workspace/MariaDB/sql/handler.cc:5876
          #12 0x0000000000b23619 in unlock_external (thd=0x7fffa4000b00, table=0x7fffa4012e00, count=1)
              at /home/vicentiu/Workspace/MariaDB/sql/lock.cc:716
          #13 0x0000000000b23772 in mysql_unlock_tables (thd=0x7fffa4000b00, sql_lock=0x7fffa4012dd8,
              free_lock=false) at /home/vicentiu/Workspace/MariaDB/sql/lock.cc:428
          #14 0x0000000000b2386b in mysql_unlock_tables (thd=0x7fffa4000b00, sql_lock=0x7fffa4012dd8)
              at /home/vicentiu/Workspace/MariaDB/sql/lock.cc:417
          #15 0x0000000000665a69 in close_thread_tables (thd=0x7fffa4000b00)
              at /home/vicentiu/Workspace/MariaDB/sql/sql_base.cc:840
          #16 0x00000000006fbe29 in mysql_execute_command (thd=0x7fffa4000b00)
              at /home/vicentiu/Workspace/MariaDB/sql/sql_parse.cc:6255
          #17 0x00000000006ece2a in mysql_parse (thd=0x7fffa4000b00,
              rawbuf=0x7fffa40123e8 "INSERT INTO t2  VALUES (1, 5)", length=29, parser_state=0x7fffe80823d8,
              is_com_multi=false, is_next_command=false)
              at /home/vicentiu/Workspace/MariaDB/sql/sql_parse.cc:7874
          

          cvicentiu Vicențiu Ciorbaru added a comment - Stacktrace: #0 __longjmp () at ../sysdeps/x86_64/__longjmp.S:45 #1 0x00007ffff57cf289 in __libc_siglongjmp (env=0x7fffa4032c28, val=7) at longjmp.c:38 #2 0x00007ffff013f793 in VALBLK::ChkTyp (this=0x7fff9c000180, v=0x7fff9bfffa60) at /home/vicentiu/Workspace/MariaDB/storage/connect/valblk.cpp:219 #3 0x00007ffff0143f15 in TYPBLK<int>::SetValue (this=0x7fff9c000180, valp=0x7fff9bfffa60, n=0) at /home/vicentiu/Workspace/MariaDB/storage/connect/valblk.cpp:288 #4 0x00007ffff015edd9 in KXYCOL::SetValue (this=0x7fff9c000048, colp=0x7fff9bfff9a0, i=0) at /home/vicentiu/Workspace/MariaDB/storage/connect/xindex.cpp:3178 #5 0x00007ffff015e2ee in XINDEX::Make (this=0x7fff9bfffed0, g=0x7fffa40328b0, sxp=0x7fff9bfff318) at /home/vicentiu/Workspace/MariaDB/storage/connect/xindex.cpp:504 #6 0x00007ffff01098e5 in TDBDOS::MakeIndex (this=0x7fff9bfff4e0, g=0x7fffa40328b0, pxdf=0x7fff9bfff318, add=false) at /home/vicentiu/Workspace/MariaDB/storage/connect/tabdos.cpp:1753 #7 0x00007ffff0105b7a in TDBDOS::ResetTableOpt (this=0x7fff9bfff4e0, g=0x7fffa40328b0, dop=true, dox=true) at /home/vicentiu/Workspace/MariaDB/storage/connect/tabdos.cpp:611 #8 0x00007ffff00bd724 in CntCloseTable (g=0x7fffa40328b0, tdbp=0x7fff9bfff4e0, nox=false, abort=false) at /home/vicentiu/Workspace/MariaDB/storage/connect/connect.cc:638 #9 0x00007ffff00a554d in ha_connect::CloseTable (this=0x7fffa4030ac8, g=0x7fffa40328b0) at /home/vicentiu/Workspace/MariaDB/storage/connect/ha_connect.cc:1951 #10 0x00007ffff00af08b in ha_connect::external_lock (this=0x7fffa4030ac8, thd=0x7fffa4000b00, lock_type=2) at /home/vicentiu/Workspace/MariaDB/storage/connect/ha_connect.cc:4633 #11 0x00000000009d75ff in handler::ha_external_lock (this=0x7fffa4030ac8, thd=0x7fffa4000b00, lock_type=2) at /home/vicentiu/Workspace/MariaDB/sql/handler.cc:5876 #12 0x0000000000b23619 in unlock_external (thd=0x7fffa4000b00, table=0x7fffa4012e00, count=1) at /home/vicentiu/Workspace/MariaDB/sql/lock.cc:716 #13 0x0000000000b23772 in mysql_unlock_tables (thd=0x7fffa4000b00, sql_lock=0x7fffa4012dd8, free_lock=false) at /home/vicentiu/Workspace/MariaDB/sql/lock.cc:428 #14 0x0000000000b2386b in mysql_unlock_tables (thd=0x7fffa4000b00, sql_lock=0x7fffa4012dd8) at /home/vicentiu/Workspace/MariaDB/sql/lock.cc:417 #15 0x0000000000665a69 in close_thread_tables (thd=0x7fffa4000b00) at /home/vicentiu/Workspace/MariaDB/sql/sql_base.cc:840 #16 0x00000000006fbe29 in mysql_execute_command (thd=0x7fffa4000b00) at /home/vicentiu/Workspace/MariaDB/sql/sql_parse.cc:6255 #17 0x00000000006ece2a in mysql_parse (thd=0x7fffa4000b00, rawbuf=0x7fffa40123e8 "INSERT INTO t2 VALUES (1, 5)", length=29, parser_state=0x7fffe80823d8, is_com_multi=false, is_next_command=false) at /home/vicentiu/Workspace/MariaDB/sql/sql_parse.cc:7874

          It appears to be fixed by this commit in https://github.com/Buggynours/MariaDB ob-10.0

          commit e52bf147144c237b87dbf5226115833c68b2f543
          Author: Olivier Bertrand <bertrandop@gmail.com>
          Date:   Sun Mar 5 19:43:17 2017 +0100
           
              Replace setjmp-longjmp's by try_catch-throw
                modified:   storage/connect/CMakeLists.txt
                modified:   storage/connect/array.cpp
                modified:   storage/connect/blkfil.cpp
                modified:   storage/connect/colblk.cpp
                modified:   storage/connect/connect.cc
                modified:   storage/connect/filamtxt.cpp
                modified:   storage/connect/filamvct.cpp
                modified:   storage/connect/filter.cpp
                modified:   storage/connect/global.h
                modified:   storage/connect/ha_connect.cc
                modified:   storage/connect/jdbconn.cpp
                modified:   storage/connect/json.cpp
                modified:   storage/connect/jsonudf.cpp
                modified:   storage/connect/odbconn.cpp
                modified:   storage/connect/osutil.c
                modified:   storage/connect/plgdbutl.cpp
                deleted:    storage/connect/plugutil.c
                added:      storage/connect/plugutil.cpp
                modified:   storage/connect/tabdos.cpp
                modified:   storage/connect/tabfix.cpp
                modified:   storage/connect/tabfmt.cpp
                modified:   storage/connect/tabjdbc.cpp
                modified:   storage/connect/tabjdbc.h
                modified:   storage/connect/tabjson.cpp
                modified:   storage/connect/tabmul.cpp
                modified:   storage/connect/tabmul.h
                modified:   storage/connect/tabmysql.cpp
                modified:   storage/connect/tabodbc.cpp
                modified:   storage/connect/tabodbc.h
                modified:   storage/connect/tabpivot.cpp
                modified:   storage/connect/tabsys.cpp
                modified:   storage/connect/tabvct.cpp
                modified:   storage/connect/tabvir.cpp
                modified:   storage/connect/tabxml.cpp
                modified:   storage/connect/valblk.cpp
                modified:   storage/connect/value.cpp
          

          The fix is already in all main branches, released in 10.0.31 and 10.1.24, and will be released in 10.2.7.

          elenst Elena Stepanova added a comment - It appears to be fixed by this commit in https://github.com/Buggynours/MariaDB ob-10.0 commit e52bf147144c237b87dbf5226115833c68b2f543 Author: Olivier Bertrand <bertrandop@gmail.com> Date: Sun Mar 5 19:43:17 2017 +0100   Replace setjmp-longjmp's by try_catch-throw modified: storage/connect/CMakeLists.txt modified: storage/connect/array.cpp modified: storage/connect/blkfil.cpp modified: storage/connect/colblk.cpp modified: storage/connect/connect.cc modified: storage/connect/filamtxt.cpp modified: storage/connect/filamvct.cpp modified: storage/connect/filter.cpp modified: storage/connect/global.h modified: storage/connect/ha_connect.cc modified: storage/connect/jdbconn.cpp modified: storage/connect/json.cpp modified: storage/connect/jsonudf.cpp modified: storage/connect/odbconn.cpp modified: storage/connect/osutil.c modified: storage/connect/plgdbutl.cpp deleted: storage/connect/plugutil.c added: storage/connect/plugutil.cpp modified: storage/connect/tabdos.cpp modified: storage/connect/tabfix.cpp modified: storage/connect/tabfmt.cpp modified: storage/connect/tabjdbc.cpp modified: storage/connect/tabjdbc.h modified: storage/connect/tabjson.cpp modified: storage/connect/tabmul.cpp modified: storage/connect/tabmul.h modified: storage/connect/tabmysql.cpp modified: storage/connect/tabodbc.cpp modified: storage/connect/tabodbc.h modified: storage/connect/tabpivot.cpp modified: storage/connect/tabsys.cpp modified: storage/connect/tabvct.cpp modified: storage/connect/tabvir.cpp modified: storage/connect/tabxml.cpp modified: storage/connect/valblk.cpp modified: storage/connect/value.cpp The fix is already in all main branches, released in 10.0.31 and 10.1.24, and will be released in 10.2.7.

          People

            Unassigned Unassigned
            alice Alice Sherepa
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.