Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7601 Server crashes in different ways while executing concurrent flow involving views and non-empty sql_mode
  3. MDEV-7589

Server crashes in _mi_make_key on inserting into a MyISAM table after a sequence of statements

    XMLWordPrintable

Details

    Description

      Important note:
      I am only getting the crash on our official binaries built in buildbot (I tried bintar packages, both old glibc and new glibc). With them, it's reproducible on 5.5.39 and higher, as well as on the last build, revision fdd6c111c254c5044cd9b6c2f7e4d0c74f427a79.
      But I could not reproduce it on my own builds, neither debug nor release nor valgrind, and didn't get any valgrind errors on either of those.
      Due to this strange nature of the bug, I cannot confirm it doesn't exist in MySQL versions or in 10.0, even though I didn't observe the crash there. So, I am setting it to be fixed in 10.0 as well, please amend the Fix Version(s) field if it's not applicable to 10.0.

      Stack trace from buildbot build 7443 (5.5 revision fdd6c111c2...)

      #2  <signal handler called>
      #3  0x0000000000a547e8 in _mi_make_key (info=0x7f83df54f400, keynr=<optimized out>, key=0x7f83df54ffef "", record=0x7f83df45bc18 "\377\377\001", filepos=0) at /home/buildbot/buildbot/build/storage/myisam/mi_key.c:112
      #4  0x0000000000a6a51f in mi_write (info=0x7f83df54f400, record=0x7f83df45bc18 "\377\377\001") at /home/buildbot/buildbot/build/storage/myisam/mi_write.c:121
      #5  0x00000000006e22f2 in handler::ha_write_row (this=0x7f83df542218, buf=0x7f83df45bc18 "\377\377\001") at /home/buildbot/buildbot/build/sql/handler.cc:5203
      #6  0x0000000000564f56 in write_record (thd=0x7f83e0318000, table=0x7f83df4db000, info=0x7f83e5f1b200) at /home/buildbot/buildbot/build/sql/sql_insert.cc:1843
      #7  0x000000000056e058 in mysql_insert (thd=0x7f83e0318000, table_list=0x7f83df41f118, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at /home/buildbot/buildbot/build/sql/sql_insert.cc:986
      #8  0x0000000000585db4 in mysql_execute_command (thd=0x7f83e0318000) at /home/buildbot/buildbot/build/sql/sql_parse.cc:2974
      #9  0x0000000000587141 in mysql_parse (thd=0x7f83e0318000, rawbuf=0x7f83df41f018 "INSERT INTO `B` ( `pk` ) VALUES (1)", length=<optimized out>, parser_state=0x7f83e5f1cc10) at /home/buildbot/buildbot/build/sql/sql_parse.cc:5909
      #10 0x000000000058886c in dispatch_command (command=COM_QUERY, thd=0x7f83e0318000, packet=<optimized out>, packet_length=35) at /home/buildbot/buildbot/build/sql/sql_parse.cc:1079
      #11 0x0000000000588e12 in do_command (thd=0x7f83e0318000) at /home/buildbot/buildbot/build/sql/sql_parse.cc:793
      #12 0x0000000000643c13 in do_handle_one_connection (thd_arg=0x7f83e0318000) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1266
      #13 0x0000000000643d5c in handle_one_connection (arg=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1181
      #14 0x00000000009b0a18 in pfs_spawn_thread (arg=<optimized out>) at /home/buildbot/buildbot/build/storage/perfschema/pfs.cc:1015
      #15 0x00007f83e5b9cb50 in start_thread (arg=<optimized out>) at pthread_create.c:304
      #16 0x00007f83e4d1a70d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7f83df41f018): INSERT INTO `B` ( `pk` ) VALUES (1)
      Connection ID (thread ID): 3
      Status: NOT_KILLED

      Test case

      SET GLOBAL sql_mode=ONLY_FULL_GROUP_BY;
       
      CREATE TABLE A (
       pk INTEGER,
       col_int_nokey INTEGER /*! NULL */,
       col_int_key INTEGER /*! NULL */,
       col_date_key DATE /*! NULL */,
       col_date_nokey DATE /*! NULL */,
       col_time_key TIME /*! NULL */,
       col_time_nokey TIME /*! NULL */,
       col_datetime_key DATETIME /*! NULL */,
       col_datetime_nokey DATETIME /*! NULL */,
       col_varchar_key VARCHAR(1) /*! NULL */,
       col_varchar_nokey VARCHAR(1) /*! NULL */,
       PRIMARY KEY (pk),
       KEY (col_varchar_key, col_int_key)
       ) ENGINE=MyISAM;
       
      CREATE VIEW view_A AS SELECT * FROM A;
       
      CREATE TABLE B (
       pk INTEGER,
       col_int_key INTEGER /*! NULL */,
       col_date_key DATE /*! NULL */,
       col_time_key TIME /*! NULL */,
       col_datetime_key DATETIME /*! NULL */,
       col_varchar_key VARCHAR(1) /*! NULL */,
       col_varchar_nokey VARCHAR(1) /*! NULL */,
       b INTEGER DEFAULT NULL,
       g INTEGER DEFAULT NULL,
       PRIMARY KEY (pk),
       KEY (col_int_key),
       KEY (col_date_key),
       KEY (col_time_key),
       KEY (col_datetime_key),
       KEY (col_varchar_key, col_int_key),
       KEY (b),
       KEY (g)
       ) ENGINE=MyISAM;
       
      CREATE TABLE D (
       pk INTEGER,
       col_int_key INTEGER /*! NULL */,
       col_date_key DATE /*! NULL */,
       col_time_key TIME /*! NULL */,
       col_datetime_key DATETIME /*! NULL */,
       col_datetime_nokey DATETIME /*! NULL */,
       col_varchar_key VARCHAR(1) /*! NULL */,
       col_varchar_nokey VARCHAR(1) /*! NULL */,
       o INTEGER DEFAULT NULL,
       k INTEGER DEFAULT NULL,
       PRIMARY KEY (pk),
       KEY (col_int_key),
       KEY (col_date_key),
       KEY (col_time_key),
       KEY (col_datetime_key),
       KEY (col_varchar_key, col_int_key),
       KEY (k),
       KEY (o)
       ) ENGINE=MyISAM;
       
      CREATE TABLE BB (
       pk INTEGER,
       col_int_nokey INTEGER /*! NULL */,
       col_int_key INTEGER /*! NULL */,
       col_date_key DATE /*! NULL */,
       col_date_nokey DATE /*! NULL */,
       col_time_key TIME /*! NULL */,
       col_time_nokey TIME /*! NULL */,
       col_datetime_key DATETIME /*! NULL */,
       col_datetime_nokey DATETIME /*! NULL */,
       col_varchar_key VARCHAR(1) /*! NULL */,
       col_varchar_nokey VARCHAR(1) /*! NULL */,
       PRIMARY KEY (pk),
       KEY (col_varchar_key, col_int_key)
       ) ENGINE=MyISAM;
       
      CREATE VIEW view_BB AS SELECT * FROM BB;
       
      CREATE TABLE DD (
       pk INTEGER AUTO_INCREMENT,
       col_int_key INTEGER /*! NULL */,
       col_varchar_key VARCHAR(1) /*! NULL */,
       PRIMARY KEY (pk),
       KEY (col_varchar_key, col_int_key)
       ) ENGINE=MyISAM;
       
      CREATE VIEW view_DD AS SELECT * FROM DD;
       
      --connect (con10,localhost,root,,test)
       
      CREATE TRIGGER k BEFORE INSERT ON `DD` FOR EACH ROW INSERT INTO `view_BB` SELECT * FROM `view_A` LIMIT 0 ; 
      INSERT INTO `view_DD` ( `pk` ) VALUES (1);
      SELECT * FROM INFORMATION_SCHEMA.`STATISTICS` AS table1 ORDER BY table1.`SEQ_IN_INDEX`, table1.`NULLABLE` LIMIT 255;
       
      --connect (con9,localhost,root,,test)
       
      CREATE TRIGGER w BEFORE INSERT ON `D` FOR EACH ROW INSERT INTO `C` SELECT * FROM `AA` LIMIT 0 ; 
       
      --connection con10
       
      --error ER_NON_GROUPING_FIELD_USED
      SELECT * FROM test.`D` AS table1 HAVING table1.`pk` <> 'n' LIMIT 197;
       
      --connection con9
       
      ALTER TABLE `B` ADD COLUMN n INTEGER DEFAULT NULL;
       
      --connection con10
       
      DELETE FROM `B` LIMIT 3;
      INSERT INTO `DD` ( `pk` ) VALUES (2);
      INSERT INTO `B` ( `pk` ) VALUES (1);

      Attachments

        Activity

          People

            monty Michael Widenius
            elenst Elena Stepanova
            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.