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

Assertion `dec <= 6' failed in my_timestamp_binary_length

Details

    Description

      SELECT FROM_UNIXTIME('1922-02-10'), BIT_AND(1);
      

      preview-11.7-preview 5ef8ae9af2bbc6b21a3ab21df65a9e8ffe4d152d

      mariadbd: /git/11.7/sql/compat56.cc:391: uint my_timestamp_binary_length(uint): Assertion `dec <= 6' failed.
      241025 11:01:42 [ERROR] mysqld got signal 6 ;
       
      Server version: 11.7.0-MariaDB-debug-log source revision: 5ef8ae9af2bbc6b21a3ab21df65a9e8ffe4d152d
       
      /lib/x86_64-linux-gnu/libc.so.6(+0x33fd6)[0x7f268c0dafd6]
      sql/compat56.cc:392(my_timestamp_binary_length(unsigned int))[0x560d129f3ab0]
      sql/sql_type.cc:444(Timestamp::to_native(Native*, unsigned int) const)[0x560d12804b6d]
      sql/sql_type.cc:502(Timestamp_or_zero_datetime::to_native(Native*, unsigned int) const)[0x560d1280515e]
      sql/item.h:6830(Item_copy_timestamp::val_native(THD*, Native*))[0x560d12858e5f]
      sql/sql_type.cc:9446(Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null(THD*, Item*, bool))[0x560d1283d887]
      sql/sql_type.h:2953(Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null(THD*, Item*))[0x560d12088d1b]
      sql/sql_type.cc:7711(Type_handler::Item_send_timestamp(Item*, Protocol*, st_value*) const)[0x560d1282db8a]
      sql/sql_type.h:6949(Type_handler_timestamp_common::Item_send(Item*, Protocol*, st_value*) const)[0x560d1257b93c]
      sql/item.h:1251(Item::send(Protocol*, st_value*))[0x560d11ce3bf6]
      sql/protocol.cc:1353(Protocol::send_result_set_row(List<Item>*))[0x560d11dbc19c]
      sql/sql_class.cc:3276(select_send::send_data(List<Item>&))[0x560d11f78416]
      sql/sql_class.h:6222(select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long))[0x560d122cf6f5]
      sql/sql_select.cc:25151(end_send_group(JOIN*, st_join_table*, bool))[0x560d122858f9]
      sql/sql_select.cc:23094(do_select(JOIN*, Procedure*))[0x560d122768f6]
      sql/sql_select.cc:5026(JOIN::exec_inner())[0x560d121f32d5]
      sql/sql_select.cc:4809(JOIN::exec())[0x560d121f064c]
      sql/sql_select.cc:5342(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x560d121f4f0a]
      sql/sql_select.cc:625(handle_select(THD*, LEX*, select_result*, unsigned long long))[0x560d121c2940]
      sql/sql_parse.cc:6157(execute_sqlcom_select(THD*, TABLE_LIST*))[0x560d120ddbd6]
      sql/sql_parse.cc:3955(mysql_execute_command(THD*, bool))[0x560d120cd623]
      sql/sql_parse.cc:7879(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x560d120e8c74]
      sql/sql_parse.cc:1894(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x560d120bf0c3]
      sql/sql_parse.cc:1405(do_command(THD*, bool))[0x560d120bbd5a]
      sql/sql_connect.cc:1448(do_handle_one_connection(CONNECT*, bool))[0x560d125cc278]
      sql/sql_connect.cc:1352(handle_one_connection)[0x560d125cbc03]
      perfschema/pfs.cc:2200(pfs_spawn_thread)[0x560d133a5ac0]
      nptl/pthread_create.c:478(start_thread)[0x7f268c68b609]
       
      Query (0x6290001092a8): SELECT FROM_UNIXTIME('1922-02-10'), BIT_AND(1)
      

      SELECT 1 FROM (values(1),(2)) dt GROUP BY from_unixtime('a') WITH ROLLUP;
      

      preview-11.7-preview

      mariadbd: /11.7/sql/compat56.cc:391: uint my_timestamp_binary_length(uint): Assertion `dec <= 6' failed.
      241025 10:44:50 [ERROR] mysqld got signal 6 ;
       
      Server version: 11.7.0-MariaDB-debug-log source revision: 5ef8ae9af2bbc6b21a3ab21df65a9e8ffe4d152d
       
      /lib/x86_64-linux-gnu/libc.so.6(+0x33fd6)[0x7efe8e308fd6]
      sql/compat56.cc:392(my_timestamp_binary_length(unsigned int))[0x563adc2a7ab0]
      sql/filesort.cc:2120(Type_handler_timestamp_common::sort_length(THD*, Type_std_attributes const*, SORT_FIELD_ATTR*) const)[0x563adc34133b]
      sql/filesort.cc:2227(sortlength(THD*, Sort_keys*, bool*))[0x563adc341fa9]
      sql/filesort.cc:310(filesort(THD*, TABLE*, Filesort*, Filesort_tracker*, JOIN*, unsigned long long))[0x563adc33396e]
      sql/sql_select.cc:27200(create_sort_index(THD*, JOIN*, st_join_table*, Filesort*))[0x563adbb47c94]
      sql/sql_select.cc:24734(st_join_table::sort_table())[0x563adbb34fc9]
      sql/sql_select.cc:24654(join_init_read_record(st_join_table*))[0x563adbb343ab]
      sql/sql_select.cc:23649(sub_select(JOIN*, st_join_table*, bool))[0x563adbb2d665]
      sql/sql_select.cc:23163(do_select(JOIN*, Procedure*))[0x563adbb2afe5]
      sql/sql_select.cc:5026(JOIN::exec_inner())[0x563adbaa72d5]
      sql/sql_select.cc:4809(JOIN::exec())[0x563adbaa464c]
      sql/sql_select.cc:5342(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x563adbaa8f0a]
      sql/sql_select.cc:625(handle_select(THD*, LEX*, select_result*, unsigned long long))[0x563adba76940]
      sql/sql_parse.cc:6157(execute_sqlcom_select(THD*, TABLE_LIST*))[0x563adb991bd6]
      sql/sql_parse.cc:3955(mysql_execute_command(THD*, bool))[0x563adb981623]
      sql/sql_parse.cc:7879(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x563adb99cc74]
      sql/sql_parse.cc:1894(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x563adb9730c3]
      sql/sql_parse.cc:1405(do_command(THD*, bool))[0x563adb96fd5a]
      sql/sql_connect.cc:1448(do_handle_one_connection(CONNECT*, bool))[0x563adbe80278]
      sql/sql_connect.cc:1352(handle_one_connection)[0x563adbe7fc03]
      perfschema/pfs.cc:2200(pfs_spawn_thread)[0x563adcc59ac0]
      nptl/pthread_create.c:478(start_thread)[0x7efe8e8b9609]
       
      Query (0x6290001092a8): SELECT 1 FROM (values(1),(2)) dt GROUP BY from_unixtime('a') WITH ROLLUP
      
      

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov added a comment - - edited

            This script:

            SELECT * FROM (SELECT FROM_UNIXTIME('1'), BIT_AND(1)) t;
            

            also crashes with a slightly different stack:

            #0  0x00007ffff72ae834 in __pthread_kill_implementation () from /lib64/libc.so.6
            #1  0x00007ffff725c8ee in raise () from /lib64/libc.so.6
            #2  0x00007ffff72448ff in abort () from /lib64/libc.so.6
            #3  0x00007ffff724481b in __assert_fail_base.cold () from /lib64/libc.so.6
            #4  0x00007ffff7254c57 in __assert_fail () from /lib64/libc.so.6
            #5  0x0000555556476def in my_timestamp_binary_length (dec=39) at /home/bar/maria-git/11.7.m35250.ts/sql/compat56.cc:391
            #6  0x0000555556380bc1 in Timestamp::to_native (this=0x7fffc8028918, to=0x7ffff11308a0, decimals=39)
                at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.cc:469
            #7  0x0000555556380df3 in Timestamp_or_zero_datetime::to_native (this=0x7fffc8028918, to=0x7ffff11308a0, decimals=39)
                at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.cc:527
            #8  0x00005555563a17ae in Timestamp_or_zero_datetime_native::Timestamp_or_zero_datetime_native (this=0x7ffff11308a0, ts=..., 
                decimals=39) at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.h:2928
            #9  0x00005555563a82ed in Item_copy_timestamp::save_in_field (this=0x7fffc8028898, field=0x7fffc80086b0)
                at /home/bar/maria-git/11.7.m35250.ts/sql/item.h:6792
            

            Another example:

            create or replace table t1 (a text, b text);
            insert into t1 SELECT FROM_UNIXTIME('1'), BIT_AND(1);
            

            #0  0x00007ffff72ae834 in __pthread_kill_implementation () from /lib64/libc.so.6
            #1  0x00007ffff725c8ee in raise () from /lib64/libc.so.6
            #2  0x00007ffff72448ff in abort () from /lib64/libc.so.6
            #3  0x00007ffff724481b in __assert_fail_base.cold () from /lib64/libc.so.6
            #4  0x00007ffff7254c57 in __assert_fail () from /lib64/libc.so.6
            #5  0x0000555556476def in my_timestamp_binary_length (dec=39) at /home/bar/maria-git/11.7.m35250.ts/sql/compat56.cc:391
            #6  0x0000555556380bc1 in Timestamp::to_native (this=0x7fff8401b090, to=0x7ffff11310e0, decimals=39)
                at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.cc:469
            #7  0x0000555556380df3 in Timestamp_or_zero_datetime::to_native (this=0x7fff8401b090, to=0x7ffff11310e0, decimals=39)
                at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.cc:527
            #8  0x00005555563a17ae in Timestamp_or_zero_datetime_native::Timestamp_or_zero_datetime_native (this=0x7ffff11310e0, ts=..., 
                decimals=39) at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.h:2928
            #9  0x00005555563a82ed in Item_copy_timestamp::save_in_field (this=0x7fff8401b010, field=0x7fff8407c0a0)
                at /home/bar/maria-git/11.7.m35250.ts/sql/item.h:6792
            

            bar Alexander Barkov added a comment - - edited This script: SELECT * FROM ( SELECT FROM_UNIXTIME( '1' ), BIT_AND(1)) t; also crashes with a slightly different stack: #0 0x00007ffff72ae834 in __pthread_kill_implementation () from /lib64/libc.so.6 #1 0x00007ffff725c8ee in raise () from /lib64/libc.so.6 #2 0x00007ffff72448ff in abort () from /lib64/libc.so.6 #3 0x00007ffff724481b in __assert_fail_base.cold () from /lib64/libc.so.6 #4 0x00007ffff7254c57 in __assert_fail () from /lib64/libc.so.6 #5 0x0000555556476def in my_timestamp_binary_length (dec=39) at /home/bar/maria-git/11.7.m35250.ts/sql/compat56.cc:391 #6 0x0000555556380bc1 in Timestamp::to_native (this=0x7fffc8028918, to=0x7ffff11308a0, decimals=39) at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.cc:469 #7 0x0000555556380df3 in Timestamp_or_zero_datetime::to_native (this=0x7fffc8028918, to=0x7ffff11308a0, decimals=39) at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.cc:527 #8 0x00005555563a17ae in Timestamp_or_zero_datetime_native::Timestamp_or_zero_datetime_native (this=0x7ffff11308a0, ts=..., decimals=39) at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.h:2928 #9 0x00005555563a82ed in Item_copy_timestamp::save_in_field (this=0x7fffc8028898, field=0x7fffc80086b0) at /home/bar/maria-git/11.7.m35250.ts/sql/item.h:6792 Another example: create or replace table t1 (a text, b text); insert into t1 SELECT FROM_UNIXTIME('1'), BIT_AND(1); #0 0x00007ffff72ae834 in __pthread_kill_implementation () from /lib64/libc.so.6 #1 0x00007ffff725c8ee in raise () from /lib64/libc.so.6 #2 0x00007ffff72448ff in abort () from /lib64/libc.so.6 #3 0x00007ffff724481b in __assert_fail_base.cold () from /lib64/libc.so.6 #4 0x00007ffff7254c57 in __assert_fail () from /lib64/libc.so.6 #5 0x0000555556476def in my_timestamp_binary_length (dec=39) at /home/bar/maria-git/11.7.m35250.ts/sql/compat56.cc:391 #6 0x0000555556380bc1 in Timestamp::to_native (this=0x7fff8401b090, to=0x7ffff11310e0, decimals=39) at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.cc:469 #7 0x0000555556380df3 in Timestamp_or_zero_datetime::to_native (this=0x7fff8401b090, to=0x7ffff11310e0, decimals=39) at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.cc:527 #8 0x00005555563a17ae in Timestamp_or_zero_datetime_native::Timestamp_or_zero_datetime_native (this=0x7ffff11310e0, ts=..., decimals=39) at /home/bar/maria-git/11.7.m35250.ts/sql/sql_type.h:2928 #9 0x00005555563a82ed in Item_copy_timestamp::save_in_field (this=0x7fff8401b010, field=0x7fff8407c0a0) at /home/bar/maria-git/11.7.m35250.ts/sql/item.h:6792

            CREATE OR REPLACE TABLE t1 (a TEXT); INSERT INTO t1 VALUES (1),(2); SELECT * FROM t1 ORDER BY from_unixtime(a);
            

            #0  0x00007ffff72ae834 in __pthread_kill_implementation () from /lib64/libc.so.6
            #1  0x00007ffff725c8ee in raise () from /lib64/libc.so.6
            #2  0x00007ffff72448ff in abort () from /lib64/libc.so.6
            #3  0x00007ffff724481b in __assert_fail_base.cold () from /lib64/libc.so.6
            #4  0x00007ffff7254c57 in __assert_fail () from /lib64/libc.so.6
            #5  0x0000555556476e21 in my_timestamp_binary_length (dec=39) at /home/bar/maria-git/11.7.m35250.ts/sql/compat56.cc:391
            #6  0x00005555564b62ce in Type_handler_timestamp_common::sort_length (this=0x555557e4b760 <type_handler_timestamp2>, 
                thd=0x7fffc8000dc8, item=0x7fffc801a210, sortorder=0x7fffc801c9a8) at /home/bar/maria-git/11.7.m35250.ts/sql/filesort.cc:2086
            #7  0x00005555564b66a4 in sortlength (thd=0x7fffc8000dc8, sort_keys=0x7fffc8b17a90, allow_packing_for_sortkeys=0x7ffff113087f)
                at /home/bar/maria-git/11.7.m35250.ts/sql/filesort.cc:2191
            #8  0x00005555564b008a in filesort (thd=0x7fffc8000dc8, table=0x7fffc8079558, filesort=0x7fffc801c190, tracker=0x7fffc801c918, 
                join=0x7fffc801a448, first_table_bit=1) at /home/bar/maria-git/11.7.m35250.ts/sql/filesort.cc:269
            #9  0x000055555613e70d in create_sort_index (thd=0x7fffc8000dc8, join=0x7fffc801a448, tab=0x7fffc8b16d40, fsort=0x7fffc801c190)
                at /home/bar/maria-git/11.7.m35250.ts/sql/sql_select.cc:27632
            

            bar Alexander Barkov added a comment - CREATE OR REPLACE TABLE t1 (a TEXT); INSERT INTO t1 VALUES (1),(2); SELECT * FROM t1 ORDER BY from_unixtime(a); #0 0x00007ffff72ae834 in __pthread_kill_implementation () from /lib64/libc.so.6 #1 0x00007ffff725c8ee in raise () from /lib64/libc.so.6 #2 0x00007ffff72448ff in abort () from /lib64/libc.so.6 #3 0x00007ffff724481b in __assert_fail_base.cold () from /lib64/libc.so.6 #4 0x00007ffff7254c57 in __assert_fail () from /lib64/libc.so.6 #5 0x0000555556476e21 in my_timestamp_binary_length (dec=39) at /home/bar/maria-git/11.7.m35250.ts/sql/compat56.cc:391 #6 0x00005555564b62ce in Type_handler_timestamp_common::sort_length (this=0x555557e4b760 <type_handler_timestamp2>, thd=0x7fffc8000dc8, item=0x7fffc801a210, sortorder=0x7fffc801c9a8) at /home/bar/maria-git/11.7.m35250.ts/sql/filesort.cc:2086 #7 0x00005555564b66a4 in sortlength (thd=0x7fffc8000dc8, sort_keys=0x7fffc8b17a90, allow_packing_for_sortkeys=0x7ffff113087f) at /home/bar/maria-git/11.7.m35250.ts/sql/filesort.cc:2191 #8 0x00005555564b008a in filesort (thd=0x7fffc8000dc8, table=0x7fffc8079558, filesort=0x7fffc801c190, tracker=0x7fffc801c918, join=0x7fffc801a448, first_table_bit=1) at /home/bar/maria-git/11.7.m35250.ts/sql/filesort.cc:269 #9 0x000055555613e70d in create_sort_index (thd=0x7fffc8000dc8, join=0x7fffc801a448, tab=0x7fffc8b16d40, fsort=0x7fffc801c190) at /home/bar/maria-git/11.7.m35250.ts/sql/sql_select.cc:27632
            bar Alexander Barkov added a comment - Hello Sergei, Please review a patch: https://github.com/MariaDB/server/commit/d07024bee60cfaca32d4e54cedeb4bdf3a88650e Thanks

            ok to push

            serg Sergei Golubchik added a comment - ok to push

            People

              bar Alexander Barkov
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.