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

Assertion `marked_for_read()' or `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed upon SELECT from a view

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 5.5, 10.1, 10.2, 10.3, 10.4
    • Fix Version/s: N/A
    • Component/s: Data types, Views
    • Labels:
      None

      Description

      CREATE TABLE t1 (a INT) ENGINE=MyISAM;
      CREATE VIEW v1 AS SELECT * FROM t1;
      INSERT INTO t1 VALUES (1),(2);
       
      SELECT BENCHMARK(1, SUM(a)) IS NULL FROM v1;
       
      # Cleanup
      DROP VIEW v1;
      DROP TABLE t1;
      

      10.4 debug 5e0c80c2

      mysqld: /data/src/10.4/sql/field.cc:2126: virtual my_decimal* Field_int::val_decimal(my_decimal*): Assertion `marked_for_read()' failed.
      191223  1:43:31 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f74aa065f12 in __GI___assert_fail (assertion=0x5590ffe87370 "marked_for_read()", file=0x5590ffe871ab "/data/src/10.4/sql/field.cc", line=2126, function=0x5590ffe88c80 <Field_int::val_decimal(my_decimal*)::__PRETTY_FUNCTION__> "virtual my_decimal* Field_int::val_decimal(my_decimal*)") at assert.c:101
      #8  0x00005590ff316276 in Field_int::val_decimal (this=0x7f745000adc0, decimal_value=0x7f749f3fbb20) at /data/src/10.4/sql/field.cc:2126
      #9  0x00005590ff375c5c in Item_field::val_decimal (this=0x7f7450016da8, decimal_value=0x7f749f3fbb20) at /data/src/10.4/sql/item.cc:3204
      #10 0x00005590ff3859de in Item_direct_ref::val_decimal (this=0x7f745006d870, decimal_value=0x7f749f3fbb20) at /data/src/10.4/sql/item.cc:8358
      #11 0x00005590ff390154 in Item_direct_view_ref::val_decimal (this=0x7f745006d870, tmp=0x7f749f3fbb20) at /data/src/10.4/sql/item.h:5745
      #12 0x00005590ff44a384 in Aggregator_simple::arg_val_decimal (this=0x7f745006f2d0, value=0x7f749f3fbb20) at /data/src/10.4/sql/item_sum.cc:1812
      #13 0x00005590ff4498ad in Item_sum_sum::add_helper (this=0x7f74500138b0, perform_removal=false) at /data/src/10.4/sql/item_sum.cc:1635
      #14 0x00005590ff449677 in Item_sum_sum::add (this=0x7f74500138b0) at /data/src/10.4/sql/item_sum.cc:1607
      #15 0x00005590ff455295 in Aggregator_simple::add (this=0x7f745006f2d0) at /data/src/10.4/sql/item_sum.h:715
      #16 0x00005590ff08b183 in Item_sum::aggregator_add (this=0x7f74500138b0) at /data/src/10.4/sql/item_sum.h:558
      #17 0x00005590ff08b06e in Item_sum::reset_and_add (this=0x7f74500138b0) at /data/src/10.4/sql/item_sum.h:443
      #18 0x00005590ff07e76f in init_sum_functions (func_ptr=0x7f745006da98, end_ptr=0x7f745006daa0) at /data/src/10.4/sql/sql_select.cc:25261
      #19 0x00005590ff075106 in end_send_group (join=0x7f7450018410, join_tab=0x7f745006eac8, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:21642
      #20 0x00005590ff071dd6 in evaluate_join_record (join=0x7f7450018410, join_tab=0x7f745006e720, error=0) at /data/src/10.4/sql/sql_select.cc:20468
      #21 0x00005590ff0716bc in sub_select (join=0x7f7450018410, join_tab=0x7f745006e720, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20248
      #22 0x00005590ff070b4b in do_select (join=0x7f7450018410, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19786
      #23 0x00005590ff045d3d in JOIN::exec_inner (this=0x7f7450018410) at /data/src/10.4/sql/sql_select.cc:4446
      #24 0x00005590ff044e7a in JOIN::exec (this=0x7f7450018410) at /data/src/10.4/sql/sql_select.cc:4228
      #25 0x00005590ff04658f in mysql_select (thd=0x7f7450000af0, tables=0x7f7450013d28, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f74500183e8, unit=0x7f7450004a20, select_lex=0x7f7450013258) at /data/src/10.4/sql/sql_select.cc:4660
      #26 0x00005590ff03619c in handle_select (thd=0x7f7450000af0, lex=0x7f7450004958, result=0x7f74500183e8, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:420
      #27 0x00005590feffc915 in execute_sqlcom_select (thd=0x7f7450000af0, all_tables=0x7f7450013d28) at /data/src/10.4/sql/sql_parse.cc:6360
      #28 0x00005590feff1fc3 in mysql_execute_command (thd=0x7f7450000af0) at /data/src/10.4/sql/sql_parse.cc:3899
      #29 0x00005590ff000a21 in mysql_parse (thd=0x7f7450000af0, rawbuf=0x7f7450013198 "SELECT BENCHMARK(1, SUM(a)) IS NULL FROM v1", length=43, parser_state=0x7f749f3fd160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
      #30 0x00005590fefebbc6 in dispatch_command (command=COM_QUERY, thd=0x7f7450000af0, packet=0x7f7450137281 "", packet_length=43, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #31 0x00005590fefea253 in do_command (thd=0x7f7450000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #32 0x00005590ff1730c9 in do_handle_one_connection (connect=0x559102112960) at /data/src/10.4/sql/sql_connect.cc:1412
      #33 0x00005590ff172e18 in handle_one_connection (arg=0x559102112960) at /data/src/10.4/sql/sql_connect.cc:1316
      #34 0x00005590ffb76ebf in pfs_spawn_thread (arg=0x55910207f030) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #35 0x00007f74abfee4a4 in start_thread (arg=0x7f749f3fe700) at pthread_create.c:456
      #36 0x00007f74aa122d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      10.3 debug 59a08874

      mysqld: /data/src/10.3/sql/field.cc:2117: virtual my_decimal* Field_int::val_decimal(my_decimal*): 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.
      191223  1:44:36 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f00872d9f12 in __GI___assert_fail (assertion=0x558a5885eac0 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x558a5885e919 "/data/src/10.3/sql/field.cc", line=2117, function=0x558a588603a0 <Field_int::val_decimal(my_decimal*)::__PRETTY_FUNCTION__> "virtual my_decimal* Field_int::val_decimal(my_decimal*)") at assert.c:101
      #8  0x0000558a57d5c3af in Field_int::val_decimal (this=0x7f007000c860, decimal_value=0x7f00814d72a0) at /data/src/10.3/sql/field.cc:2117
      #9  0x0000558a57dc0388 in Item_field::val_decimal (this=0x7f0070014f00, decimal_value=0x7f00814d72a0) at /data/src/10.3/sql/item.cc:3440
      #10 0x0000558a57dd013e in Item_direct_ref::val_decimal (this=0x7f0070016c00, decimal_value=0x7f00814d72a0) at /data/src/10.3/sql/item.cc:8533
      #11 0x0000558a57ddaf7e in Item_direct_view_ref::val_decimal (this=0x7f0070016c00, tmp=0x7f00814d72a0) at /data/src/10.3/sql/item.h:5347
      #12 0x0000558a57e8faba in Aggregator_simple::arg_val_decimal (this=0x7f00700185b8, value=0x7f00814d72a0) at /data/src/10.3/sql/item_sum.cc:1816
      #13 0x0000558a57e8f027 in Item_sum_sum::add_helper (this=0x7f0070012ad8, perform_removal=false) at /data/src/10.3/sql/item_sum.cc:1634
      #14 0x0000558a57e8edf1 in Item_sum_sum::add (this=0x7f0070012ad8) at /data/src/10.3/sql/item_sum.cc:1606
      #15 0x0000558a57e9a15d in Aggregator_simple::add (this=0x7f00700185b8) at /data/src/10.3/sql/item_sum.h:706
      #16 0x0000558a57b1598d in Item_sum::aggregator_add (this=0x7f0070012ad8) at /data/src/10.3/sql/item_sum.h:551
      #17 0x0000558a57b15878 in Item_sum::reset_and_add (this=0x7f0070012ad8) at /data/src/10.3/sql/item_sum.h:441
      #18 0x0000558a57b0a494 in init_sum_functions (func_ptr=0x7f0070016e48, end_ptr=0x7f0070016e50) at /data/src/10.3/sql/sql_select.cc:24579
      #19 0x0000558a57b00dfd in end_send_group (join=0x7f0070015ce0, join_tab=0x7f0070017dc8, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:20963
      #20 0x0000558a57afdaf4 in evaluate_join_record (join=0x7f0070015ce0, join_tab=0x7f0070017a38, error=0) at /data/src/10.3/sql/sql_select.cc:19798
      #21 0x0000558a57afd3b3 in sub_select (join=0x7f0070015ce0, join_tab=0x7f0070017a38, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:19578
      #22 0x0000558a57afc83d in do_select (join=0x7f0070015ce0, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:19118
      #23 0x0000558a57ad3a35 in JOIN::exec_inner (this=0x7f0070015ce0) at /data/src/10.3/sql/sql_select.cc:4092
      #24 0x0000558a57ad2e08 in JOIN::exec (this=0x7f0070015ce0) at /data/src/10.3/sql/sql_select.cc:3886
      #25 0x0000558a57ad4119 in mysql_select (thd=0x7f0070000af0, tables=0x7f0070012f50, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f0070015cb8, unit=0x7f00700049c0, select_lex=0x7f0070005148) at /data/src/10.3/sql/sql_select.cc:4291
      #26 0x0000558a57ac581e in handle_select (thd=0x7f0070000af0, lex=0x7f00700048f8, result=0x7f0070015cb8, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:370
      #27 0x0000558a57a8d22d in execute_sqlcom_select (thd=0x7f0070000af0, all_tables=0x7f0070012f50) at /data/src/10.3/sql/sql_parse.cc:6294
      #28 0x0000558a57a83c29 in mysql_execute_command (thd=0x7f0070000af0) at /data/src/10.3/sql/sql_parse.cc:3821
      #29 0x0000558a57a91525 in mysql_parse (thd=0x7f0070000af0, rawbuf=0x7f0070012818 "SELECT BENCHMARK(1, SUM(a)) IS NULL FROM v1", length=43, parser_state=0x7f00814d85e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7818
      #30 0x0000558a57a7e071 in dispatch_command (command=COM_QUERY, thd=0x7f0070000af0, packet=0x7f0070123431 "", packet_length=43, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856
      #31 0x0000558a57a7c9b9 in do_command (thd=0x7f0070000af0) at /data/src/10.3/sql/sql_parse.cc:1401
      #32 0x0000558a57bf4242 in do_handle_one_connection (connect=0x558a5a77ac20) at /data/src/10.3/sql/sql_connect.cc:1403
      #33 0x0000558a57bf3fa4 in handle_one_connection (arg=0x558a5a77ac20) at /data/src/10.3/sql/sql_connect.cc:1308
      #34 0x0000558a585a1ed8 in pfs_spawn_thread (arg=0x558a5a795bd0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #35 0x00007f00892624a4 in start_thread (arg=0x7f00814d9700) at pthread_create.c:456
      #36 0x00007f0087396d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      The former assertion failure is reproducible on 10.4-10.5, the latter on 5.5-10.3.
      Not reproducible with InnoDB.
      No obvious effect on a non-debug build.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              varun Varun Gupta
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: