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

LP:1058071 - crash with small join_buffer_size and outer_join_with_cache+join_cache_incremental in JOIN_CACHE::read_record_field

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5.27, 5.3.8
    • Fix Version/s: 5.5.28, 5.3.10
    • Component/s: None
    • Labels:
      None

      Description

      The report was originally filed at LaunchPad by sbester:
      https://bugs.launchpad.net/maria/+bug/1058071

      Stack trace on maria/5.3 version-info

      revision-id: knielsen@knielsen-hq.org-20120928075443-8bygto4wb3pj0nvs
      date: 2012-09-28 09:54:43 +0200
      build-date: 2012-09-28 23:48:19 +0400
      revno: 3581

      #3  <signal handler called>
      #4  __memcpy_ssse3 () at ../sysdeps/x86_64/multiarch/memcpy-ssse3.S:2235
      #5  0x000000000071df2f in JOIN_CACHE::read_record_field (this=0x2791d88, copy=0x2791f50, blob_in_rec_buff=false) at sql_join_cache.cc:1836
      #6  0x000000000071db19 in JOIN_CACHE::read_all_record_fields (this=0x2791d88) at sql_join_cache.cc:1717
      #7  0x000000000071d8e2 in JOIN_CACHE::get_record_by_pos (this=0x2791d88, rec_ptr=0x279385f "") at sql_join_cache.cc:1616
      #8  0x000000000071d89d in JOIN_CACHE::get_record (this=0x2791f88) at sql_join_cache.cc:1588
      #9  0x00000000007208bd in JOIN_CACHE_BNL::read_next_candidate_for_match (this=0x2791f88, rec_ptr=0x27940d6 "") at sql_join_cache.cc:3553
      #10 0x000000000071ea79 in JOIN_CACHE::join_matching_records (this=0x2791f88, skip_last=false) at sql_join_cache.cc:2266
      #11 0x000000000071e4b8 in JOIN_CACHE::join_records (this=0x2791f88, skip_last=false) at sql_join_cache.cc:2064
      #12 0x000000000071e4fe in JOIN_CACHE::join_records (this=0x2791d88, skip_last=false) at sql_join_cache.cc:2078
      #13 0x000000000077508a in sub_select_cache (join=0x278d220, join_tab=0x278ff18, end_of_records=true) at sql_select.cc:15496
      #14 0x000000000077529f in sub_select (join=0x278d220, join_tab=0x278fbf8, end_of_records=true) at sql_select.cc:15658
      #15 0x0000000000774d74 in do_select (join=0x278d220, fields=0x0, table=0x27941b0, procedure=0x0) at sql_select.cc:15380
      #16 0x0000000000753cc3 in JOIN::exec (this=0x278d220) at sql_select.cc:2308
      #17 0x000000000075634b in mysql_select (thd=0x26539d8, rref_pointer_array=0x26566c8, tables=0x26d9b88, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x26db620, having=0x0, proc_param=0x0, select_options=2147764736, result=0x26db708, unit=0x2655f68, select_lex=0x2656470) at sql_select.cc:2982
      #18 0x000000000074cd2d in handle_select (thd=0x26539d8, lex=0x2655ec8, result=0x26db708, setup_tables_done_option=0) at sql_select.cc:286
      #19 0x00000000006d92be in execute_sqlcom_select (thd=0x26539d8, all_tables=0x26d9b88) at sql_parse.cc:5157
      #20 0x00000000006d0086 in mysql_execute_command (thd=0x26539d8) at sql_parse.cc:2290
      #21 0x00000000006dbd26 in mysql_parse (thd=0x26539d8, rawbuf=0x26d9970 "select 1 from t1\nnatural left join t2\nleft outer join t3 on 1\ngroup by elt(t1.col282,1,t1.col280)", length=97, found_semicolon=0x7f5f12fd37e8) at sql_parse.cc:6158
      #22 0x00000000006cd7a5 in dispatch_command (command=COM_QUERY, thd=0x26539d8, packet=0x26d0509 "select 1 from t1\nnatural left join t2\nleft outer join t3 on 1\ngroup by elt(t1.col282,1,t1.col280)", packet_length=97) at sql_parse.cc:1228
      #23 0x00000000006cca8c in do_command (thd=0x26539d8) at sql_parse.cc:923
      #24 0x00000000006c9924 in handle_one_connection (arg=0x26539d8) at sql_connect.cc:1218
      #25 0x00007f5f1c7dcefc in start_thread (arg=0x7f5f12fd4700) at pthread_create.c:304
      #26 0x00007f5f1bd8459d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      Also reproducible on maria/5.5

      The original test case is attached to the LP bug. Please use it if the shortened one below doesn't work for you on whatever reason. Please also note that the original description suggests to run the test with valgrind.

      Shorter test case:

      SET optimizer_switch = 'outer_join_with_cache=on,join_cache_incremental=on';
       
      CREATE TABLE t1 (
        col269 decimal(31,10) unsigned DEFAULT NULL,
        col280 multipoint DEFAULT NULL,
        col281 tinyint(1) DEFAULT NULL,
        col282 time NOT NULL,
        col284 datetime DEFAULT NULL,
        col286 date DEFAULT NULL,
        col287 datetime DEFAULT NULL,
        col288 decimal(30,29) DEFAULT NULL,
        col291 time DEFAULT NULL,
        col292 time DEFAULT NULL
      ) ENGINE=Aria;
       
      INSERT INTO t1 VALUES
      (0.0,PointFromText('POINT(9 0)'),0,'11:24:05','2013-04-14 21:30:28',NULL,'2011-12-20 06:00:34',9.9,'13:04:39',NULL),
      (0.0,NULL,127,'05:43:12','2012-09-05 06:15:27','2027-01-01','2011-10-29 10:48:29',0.0,'06:24:05','11:33:37'),
      (0.0,NULL,127,'12:54:41','2013-01-12 11:32:58','2011-11-03','2013-01-03 02:00:34',00,'11:54:15','20:19:15'),
      (0.0,PointFromText('POINT(9 0)'),0,'19:48:07','2012-07-16 15:45:25','2012-03-25','2013-09-07 17:21:52',0.5,'17:36:54','21:24:19'),
      (0.0,PointFromText('POINT(9 0)'),0,'03:43:48','2012-09-28 00:00:00','2012-06-26','2011-11-16 05:01:09',00,'01:25:42','19:30:06'),
      (0.0,LineStringFromText('LINESTRING(0 0,9 9,0 0,9 0,0 0)'),127,'11:33:21','2012-03-31 10:29:22','2012-10-10','2012-04-21 19:21:06',NULL,'05:13:22','09:48:34'),
      (NULL,PointFromText('POINT(9 0)'),127,'00:00:00','0000-00-00','2012-04-04 21:26:12','2013-03-04',0.0,'12:54:30',NULL),
      (NULL,PointFromText('POINT(9 0)'),1,'00:00:00','2013-05-01 22:37:49','2013-06-26','2012-09-22 17:31:03',0.0,'08:09:57','11:15:36');
       
      CREATE TABLE t2 (b int) ENGINE=Aria;
      INSERT INTO t2 VALUES (NULL);
      CREATE TABLE t3 (c int) ENGINE=Aria;
      INSERT INTO t3 VALUES (NULL);
       
      set join_buffer_size=1;
       
      select 1 from t1
      natural left join t2
      left outer join t3 on 1
      group by elt(t1.col282,1,t1.col280);
       

      Minimal optimizer_switch: outer_join_with_cache=on,join_cache_incremental=on

      EXPLAIN

      id      select_type     table   type    possible_keys   key     key_len ref     rows  filtered Extra
      1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    8       100.00  Using temporary; Using filesort
      1       SIMPLE  t2      ALL     NULL    NULL    NULL    NULL    1       100.00  Using where; Using join buffer (flat, BNL join)
      1       SIMPLE  t3      ALL     NULL    NULL    NULL    NULL    1       100.00  Using where; Using join buffer (incremental, BNL join)
      Warnings:
      Note    1003    select 1 AS `1` from `test`.`t1` left join `test`.`t2` on(1) left join `test`.`t3` on(1) where 1 group by elt(`test`.`t1`.`col282`,1,`test`.`t1`.`col280`)
       

        Attachments

          Activity

            People

            • Assignee:
              igor Igor Babaev
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: