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

Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed in JOIN_CACHE::generate_full_extensions

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL)
    • 10.5, 10.6, 10.11
    • Server
    • None

    Description

      Yet another one. We always have several open issues for this assertion failure, but it's always in different places, so I'm filing a new one when I can't find a good enough match, like for this one.

      CREATE TABLE t1 (a INT) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (1),(2);
       
      CREATE TABLE t2 (b INT, c INT) ENGINE=MyISAM;
      CREATE VIEW v2 AS SELECT * FROM t2;
      INSERT INTO t2 VALUES (1,4),(2,6);
       
      CREATE TABLE t3 (d INT, e INT) ENGINE=MyISAM;
      INSERT INTO t3 VALUES (10,8),(11,4);
       
      CREATE TABLE t4 (f INT, g INT) ENGINE=MyISAM;
      INSERT INTO t4 VALUES (10,8),(11,7);
       
      SELECT STRAIGHT_JOIN COUNT(*) FROM t1 WHERE (1,2) IN ( SELECT c, COUNT(DISTINCT b) FROM ( v2 RIGHT JOIN ( t3 INNER JOIN t4 ON (g = e) ) ON (f = d) ) GROUP BY c );
       
      # Cleanup
      DROP VIEW v2;
      DROP TABLE t1, t2, t3, t4;
      

      10.2 c17b0b73

      mysqld: /data/src/10.2/sql/field.cc:4332: virtual longlong Field_long::val_int(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed.
      190708 16:06:59 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f309eae1f12 in __GI___assert_fail (assertion=0x55f1f8126a98 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x55f1f8126838 "/data/src/10.2/sql/field.cc", line=4332, function=0x55f1f8129540 <Field_long::val_int()::__PRETTY_FUNCTION__> "virtual longlong Field_long::val_int()") at assert.c:101
      #8  0x000055f1f782ac7d in Field_long::val_int (this=0x7f308806f198) at /data/src/10.2/sql/field.cc:4332
      #9  0x000055f1f7849277 in Field::do_field_int (copy=0x7f3088052f78) at /data/src/10.2/sql/field_conv.cc:401
      #10 0x000055f1f7848a75 in do_copy_null (copy=0x7f3088052f78) at /data/src/10.2/sql/field_conv.cc:245
      #11 0x000055f1f765147a in copy_fields (param=0x7f3088052e60) at /data/src/10.2/sql/sql_select.cc:23450
      #12 0x000055f1f7649547 in end_write (join=0x7f30880498f8, join_tab=0x7f30880521b8, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:20225
      #13 0x000055f1f765aa38 in AGGR_OP::put_record (this=0x7f30880531e0, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:26749
      #14 0x000055f1f766052d in AGGR_OP::put_record (this=0x7f30880531e0) at /data/src/10.2/sql/sql_select.h:972
      #15 0x000055f1f76458d2 in sub_select_postjoin_aggr (join=0x7f30880498f8, join_tab=0x7f30880521b8, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18543
      #16 0x000055f1f7768943 in JOIN_CACHE::generate_full_extensions (this=0x7f3088052d30, rec_ptr=0x7f308818c525 "\001\371\n") at /data/src/10.2/sql/sql_join_cache.cc:2401
      #17 0x000055f1f77686b3 in JOIN_CACHE::join_matching_records (this=0x7f3088052d30, skip_last=false) at /data/src/10.2/sql/sql_join_cache.cc:2293
      #18 0x000055f1f776800e in JOIN_CACHE::join_records (this=0x7f3088052d30, skip_last=false) at /data/src/10.2/sql/sql_join_cache.cc:2087
      #19 0x000055f1f77681ae in JOIN_CACHE::join_records (this=0x7f3088052c00, skip_last=false) at /data/src/10.2/sql/sql_join_cache.cc:2133
      #20 0x000055f1f76459ab in sub_select_cache (join=0x7f30880498f8, join_tab=0x7f3088051a58, end_of_records=true) at /data/src/10.2/sql/sql_select.cc:18601
      #21 0x000055f1f7645bc5 in sub_select (join=0x7f30880498f8, join_tab=0x7f30880516a8, end_of_records=true) at /data/src/10.2/sql/sql_select.cc:18773
      #22 0x000055f1f76453ce in do_select (join=0x7f30880498f8, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18368
      #23 0x000055f1f761efb9 in JOIN::exec_inner (this=0x7f30880498f8) at /data/src/10.2/sql/sql_select.cc:3626
      #24 0x000055f1f761e468 in JOIN::exec (this=0x7f30880498f8) at /data/src/10.2/sql/sql_select.cc:3421
      #25 0x000055f1f791f4c4 in subselect_single_select_engine::exec (this=0x7f3088017908) at /data/src/10.2/sql/item_subselect.cc:3894
      #26 0x000055f1f79143cf in Item_subselect::exec (this=0x7f3088017648) at /data/src/10.2/sql/item_subselect.cc:722
      #27 0x000055f1f79149e8 in Item_in_subselect::exec (this=0x7f3088017648) at /data/src/10.2/sql/item_subselect.cc:902
      #28 0x000055f1f791767d in Item_in_subselect::val_bool (this=0x7f3088017648) at /data/src/10.2/sql/item_subselect.cc:1766
      #29 0x000055f1f7511425 in Item::val_bool_result (this=0x7f3088017648) at /data/src/10.2/sql/item.h:1248
      #30 0x000055f1f7893dce in Item_in_optimizer::val_int (this=0x7f308804ad88) at /data/src/10.2/sql/item_cmpfunc.cc:1656
      #31 0x000055f1f7866c15 in Item::val_bool (this=0x7f308804ad88) at /data/src/10.2/sql/item.cc:112
      #32 0x000055f1f765d4d8 in Item::eval_const_cond (this=0x7f308804ad88) at /data/src/10.2/sql/item.h:1186
      #33 0x000055f1f763e362 in Item::remove_eq_conds (this=0x7f308804ad88, thd=0x7f3088000b00, cond_value=0x7f3088049448, top_level_arg=true) at /data/src/10.2/sql/sql_select.cc:15900
      #34 0x000055f1f763d2f4 in optimize_cond (join=0x7f3088049138, conds=0x7f308804ad88, join_list=0x7f3088004fd8, ignore_on_conds=false, cond_value=0x7f3088049448, cond_equal=0x7f3088049570, flags=1) at /data/src/10.2/sql/sql_select.cc:15456
      #35 0x000055f1f761704a in JOIN::optimize_inner (this=0x7f3088049138) at /data/src/10.2/sql/sql_select.cc:1372
      #36 0x000055f1f76160fb in JOIN::optimize (this=0x7f3088049138) at /data/src/10.2/sql/sql_select.cc:1117
      #37 0x000055f1f761f59a in mysql_select (thd=0x7f3088000b00, tables=0x7f3088012838, wild_num=0, fields=..., conds=0x7f3088017648, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748610, result=0x7f3088018428, unit=0x7f3088004700, select_lex=0x7f3088004e38) at /data/src/10.2/sql/sql_select.cc:3807
      #38 0x000055f1f76138a0 in handle_select (thd=0x7f3088000b00, lex=0x7f3088004638, result=0x7f3088018428, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:365
      #39 0x000055f1f75df17c in execute_sqlcom_select (thd=0x7f3088000b00, all_tables=0x7f3088012838) at /data/src/10.2/sql/sql_parse.cc:6226
      #40 0x000055f1f75d5b62 in mysql_execute_command (thd=0x7f3088000b00) at /data/src/10.2/sql/sql_parse.cc:3533
      #41 0x000055f1f75e302e in mysql_parse (thd=0x7f3088000b00, rawbuf=0x7f3088012458 "SELECT STRAIGHT_JOIN COUNT(*) FROM t1 WHERE (1,2) IN ( SELECT c, COUNT(DISTINCT b) FROM ( v2 RIGHT JOIN ( t3 INNER JOIN t4 ON (g = e) ) ON (f = d) ) GROUP BY c )", length=161, parser_state=0x7f3098e15200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7760
      #42 0x000055f1f75d133d in dispatch_command (command=COM_QUERY, thd=0x7f3088000b00, packet=0x7f308808d531 "SELECT STRAIGHT_JOIN COUNT(*) FROM t1 WHERE (1,2) IN ( SELECT c, COUNT(DISTINCT b) FROM ( v2 RIGHT JOIN ( t3 INNER JOIN t4 ON (g = e) ) ON (f = d) ) GROUP BY c )", packet_length=161, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1832
      #43 0x000055f1f75cfc91 in do_command (thd=0x7f3088000b00) at /data/src/10.2/sql/sql_parse.cc:1385
      #44 0x000055f1f7723d11 in do_handle_one_connection (connect=0x55f1fa42e5b0) at /data/src/10.2/sql/sql_connect.cc:1336
      #45 0x000055f1f7723a7c in handle_one_connection (arg=0x55f1fa42e5b0) at /data/src/10.2/sql/sql_connect.cc:1241
      #46 0x000055f1f7f51c08 in pfs_spawn_thread (arg=0x55f1fa451860) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #47 0x00007f30a06564a4 in start_thread (arg=0x7f3098e16700) at pthread_create.c:456
      #48 0x00007f309eb9ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.2-10.5. Not reproducible on 10.1.
      Reproducible with MyISAM and Aria. Not reproducible with InnoDB.

      Another variant of the stack trace which is caused by an unsimplified version of the test case:

      #7  0x00007f2f225c5f12 in __GI___assert_fail (assertion=0x5582a5e18a98 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x5582a5e18838 "/data/src/10.2/sql/field.cc", line=4332, function=0x5582a5e1b540 <Field_long::val_int()::__PRETTY_FUNCTION__> "virtual longlong Field_long::val_int()") at assert.c:101
      #8  0x00005582a551cc7d in Field_long::val_int (this=0x7f2f0c0066f0) at /data/src/10.2/sql/field.cc:4332
      #9  0x00005582a553b277 in Field::do_field_int (copy=0x7f2f0c0cb338) at /data/src/10.2/sql/field_conv.cc:401
      #10 0x00005582a553ab2d in do_outer_field_null (copy=0x7f2f0c0cb338) at /data/src/10.2/sql/field_conv.cc:265
      #11 0x00005582a534347a in copy_fields (param=0x7f2f0c0cb0f8) at /data/src/10.2/sql/sql_select.cc:23450
      #12 0x00005582a533b547 in end_write (join=0x7f2f0c0bb348, join_tab=0x7f2f0c0ca040, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:20225
      #13 0x00005582a534ca38 in AGGR_OP::put_record (this=0x7f2f0c0cb190, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:26749
      #14 0x00005582a535252d in AGGR_OP::put_record (this=0x7f2f0c0cb190) at /data/src/10.2/sql/sql_select.h:972
      #15 0x00005582a53378d2 in sub_select_postjoin_aggr (join=0x7f2f0c0bb348, join_tab=0x7f2f0c0ca040, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18543
      #16 0x00005582a545a943 in JOIN_CACHE::generate_full_extensions (this=0x7f2f0c0cafc8, rec_ptr=0x7f2f0c18c521 "\001\001\374\n") at /data/src/10.2/sql/sql_join_cache.cc:2401
      #17 0x00005582a545a6b3 in JOIN_CACHE::join_matching_records (this=0x7f2f0c0cafc8, skip_last=false) at /data/src/10.2/sql/sql_join_cache.cc:2293
      #18 0x00005582a545a00e in JOIN_CACHE::join_records (this=0x7f2f0c0cafc8, skip_last=false) at /data/src/10.2/sql/sql_join_cache.cc:2087
      #19 0x00005582a53379ab in sub_select_cache (join=0x7f2f0c0bb348, join_tab=0x7f2f0c0c9c90, end_of_records=true) at /data/src/10.2/sql/sql_select.cc:18601
      #20 0x00005582a5337bc5 in sub_select (join=0x7f2f0c0bb348, join_tab=0x7f2f0c0c98e0, end_of_records=true) at /data/src/10.2/sql/sql_select.cc:18773
      #21 0x00005582a53373ce in do_select (join=0x7f2f0c0bb348, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18368
      #22 0x00005582a5310fb9 in JOIN::exec_inner (this=0x7f2f0c0bb348) at /data/src/10.2/sql/sql_select.cc:3626
      #23 0x00005582a5310468 in JOIN::exec (this=0x7f2f0c0bb348) at /data/src/10.2/sql/sql_select.cc:3421
      #24 0x00005582a56114c4 in subselect_single_select_engine::exec (this=0x7f2f0c017c68) at /data/src/10.2/sql/item_subselect.cc:3894
      #25 0x00005582a56063cf in Item_subselect::exec (this=0x7f2f0c0179a8) at /data/src/10.2/sql/item_subselect.cc:722
      #26 0x00005582a56069e8 in Item_in_subselect::exec (this=0x7f2f0c0179a8) at /data/src/10.2/sql/item_subselect.cc:902
      #27 0x00005582a560967d in Item_in_subselect::val_bool (this=0x7f2f0c0179a8) at /data/src/10.2/sql/item_subselect.cc:1766
      #28 0x00005582a5203425 in Item::val_bool_result (this=0x7f2f0c0179a8) at /data/src/10.2/sql/item.h:1248
      #29 0x00005582a5585dce in Item_in_optimizer::val_int (this=0x7f2f0c0bd0d8) at /data/src/10.2/sql/item_cmpfunc.cc:1656
      #30 0x00005582a5558c15 in Item::val_bool (this=0x7f2f0c0bd0d8) at /data/src/10.2/sql/item.cc:112
      #31 0x00005582a534f4d8 in Item::eval_const_cond (this=0x7f2f0c0bd0d8) at /data/src/10.2/sql/item.h:1186
      #32 0x00005582a5330362 in Item::remove_eq_conds (this=0x7f2f0c0bd0d8, thd=0x7f2f0c000b00, cond_value=0x7f2f0c0b94f0, top_level_arg=true) at /data/src/10.2/sql/sql_select.cc:15900
      #33 0x00005582a532f2f4 in optimize_cond (join=0x7f2f0c0b91e0, conds=0x7f2f0c0bd0d8, join_list=0x7f2f0c004fd8, ignore_on_conds=false, cond_value=0x7f2f0c0b94f0, cond_equal=0x7f2f0c0b9618, flags=1) at /data/src/10.2/sql/sql_select.cc:15456
      #34 0x00005582a530904a in JOIN::optimize_inner (this=0x7f2f0c0b91e0) at /data/src/10.2/sql/sql_select.cc:1372
      #35 0x00005582a53080fb in JOIN::optimize (this=0x7f2f0c0b91e0) at /data/src/10.2/sql/sql_select.cc:1117
      #36 0x00005582a531159a in mysql_select (thd=0x7f2f0c000b00, tables=0x7f2f0c012a10, wild_num=0, fields=..., conds=0x7f2f0c0179a8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748610, result=0x7f2f0c0b91c0, unit=0x7f2f0c004700, select_lex=0x7f2f0c004e38) at /data/src/10.2/sql/sql_select.cc:3807
      #37 0x00005582a53058a0 in handle_select (thd=0x7f2f0c000b00, lex=0x7f2f0c004638, result=0x7f2f0c0b91c0, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:365
      #38 0x00005582a52d117c in execute_sqlcom_select (thd=0x7f2f0c000b00, all_tables=0x7f2f0c012a10) at /data/src/10.2/sql/sql_parse.cc:6226
      #39 0x00005582a52c7b62 in mysql_execute_command (thd=0x7f2f0c000b00) at /data/src/10.2/sql/sql_parse.cc:3533
      #40 0x00005582a52d502e in mysql_parse (thd=0x7f2f0c000b00, rawbuf=0x7f2f0c012458 "SELECT STRAIGHT_JOIN COUNT(*) FROM `D` AS alias1 WHERE ( 2, 174 ) IN ( SELECT SQ1_alias1.`col_int_key` AS SQ1_ifield1, COUNT( DISTINCT SQ1_alias1.`pk` ) AS SQ1_ifield2 FROM ( `view_C` AS SQ1_alias1 RI"..., length=384, parser_state=0x7f2f1c8f9200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7760
      #41 0x00005582a52c333d in dispatch_command (command=COM_QUERY, thd=0x7f2f0c000b00, packet=0x7f2f0c08d531 "SELECT STRAIGHT_JOIN COUNT(*) FROM `D` AS alias1 WHERE ( 2, 174 ) IN ( SELECT SQ1_alias1.`col_int_key` AS SQ1_ifield1, COUNT( DISTINCT SQ1_alias1.`pk` ) AS SQ1_ifield2 FROM ( `view_C` AS SQ1_alias1 RI"..., packet_length=384, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1832
      #42 0x00005582a52c1c91 in do_command (thd=0x7f2f0c000b00) at /data/src/10.2/sql/sql_parse.cc:1385
      #43 0x00005582a5415d11 in do_handle_one_connection (connect=0x5582a8e3f5b0) at /data/src/10.2/sql/sql_connect.cc:1336
      #44 0x00005582a5415a7c in handle_one_connection (arg=0x5582a8e3f5b0) at /data/src/10.2/sql/sql_connect.cc:1241
      #45 0x00005582a5c43c08 in pfs_spawn_thread (arg=0x5582a8e62860) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #46 0x00007f2f2413a4a4 in start_thread (arg=0x7f2f1c8fa700) at pthread_create.c:456
      #47 0x00007f2f22682d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      The test case is attached as 3136.test. It should be checked before the bug is closed.

      Attachments

        Issue Links

          Activity

            Transition Time In Source Status Execution Times
            Alice Sherepa made transition -
            Open Confirmed
            370d 21h 33m 1

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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