Assertion `sort_field->length >= length' failed in sql/filesort.cc:1029 | abort (sig=6) in make_sortkey

Bug #1378344 reported by Ramesh Sivaraman on 2014-10-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server
Status tracked in 5.7
5.1
Undecided
Unassigned
5.5
Undecided
Unassigned
5.6
High
Unassigned
5.7
High
Unassigned

Bug Description

********************* GDB

+bt
#0 0x00007fd4d5c21771 in pthread_kill () from /lib64/libpthread.so.0
#1 0x0000000000ab6f6a in my_write_core (sig=6) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/my
sys/stacktrace.c:422
#2 0x000000000072f89f in handle_fatal_signal (sig=6) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-6
9.0/sql/signal_handler.cc:236
#3 <signal handler called>
#4 0x00007fd4d48255c9 in raise () from /lib64/libc.so.6
#5 0x00007fd4d4826cd8 in abort () from /lib64/libc.so.6
#6 0x00007fd4d481e536 in __assert_fail_base () from /lib64/libc.so.6
#7 0x00007fd4d481e5e2 in __assert_fail () from /lib64/libc.so.6
#8 0x0000000000938f83 in make_sortkey (param=0x7fd4d62102b0, to=0x7fd3dbe65719 "2001-01-01", ref_pos=0x7fd3dbc9b0f0 "") at /mnt/workspace/percona-server-5.
6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/filesort.cc:1029
#9 0x00000000009385d8 in find_all_keys (param=0x7fd4d62102b0, select=0x7fd3dbc20d48, fs_info=0x7fd4d6210240, buffpek_pointers=0x7fd4d6210450, tempfile=0x7fd4d6210330, pq=0x0, found_rows=0x7fd4d62106d0) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/filesort.cc:817
#10 0x0000000000936d91 in filesort (thd=0x7fd426eaf000, table=0x7fd3dbc53e00, filesort=0x7fd3dbc20eb8, sort_positions=false, examined_rows=0x7fd4d62106d8, found_rows=0x7fd4d62106d0) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/filesort.cc:339
#11 0x00000000007b80f7 in create_sort_index (thd=0x7fd426eaf000, join=0x7fd3dbc20010, tab=0x7fd3dbc78018) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_executor.cc:3346
#12 0x00000000007b5ba9 in st_join_table::sort_table (this=0x7fd3dbc78018) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_executor.cc:2511
#13 0x00000000007b5679 in join_init_read_record (tab=0x7fd3dbc78018) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_executor.cc:2385
#14 0x00000000007b2f23 in sub_select (join=0x7fd3dbc20010, join_tab=0x7fd3dbc78018, end_of_records=false) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_executor.cc:1256
#15 0x00000000007b290d in do_select (join=0x7fd3dbc20010) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_executor.cc:933
#16 0x00000000007b0869 in JOIN::exec (this=0x7fd3dbc20010) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_executor.cc:194
#17 0x0000000000813ebb in mysql_execute_select (thd=0x7fd426eaf000, select_lex=0x7fd426eb1c60, free_join=true) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_select.cc:1100
#18 0x00000000008141b7 in mysql_select (thd=0x7fd426eaf000, tables=0x7fd3dbc1f1d0, wild_num=0, fields=..., conds=0x0, order=0x7fd426eb1e28, group=0x7fd426eb1d60, having=0x0, select_options=2147748608, result=0x7fd3dbc1ffe8, unit=0x7fd426eb1618, select_lex=0x7fd426eb1c60) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_select.cc:1221
#19 0x0000000000812246 in handle_select (thd=0x7fd426eaf000, result=0x7fd3dbc1ffe8, setup_tables_done_option=0) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_select.cc:110
#20 0x00000000007ea732 in execute_sqlcom_select (thd=0x7fd426eaf000, all_tables=0x7fd3dbc1f1d0) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_parse.cc:5597
#21 0x00000000007e2c89 in mysql_execute_command (thd=0x7fd426eaf000) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_parse.cc:2958
#22 0x00000000007ed033 in mysql_parse (thd=0x7fd426eaf000, rawbuf=0x7fd3dbc1f010 "SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a)", length=43, parser_state=0x7fd4d6211df0) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_parse.cc:6773
#23 0x00000000007df49c in dispatch_command (command=COM_QUERY, thd=0x7fd426eaf000, packet=0x7fd416b12001 "", packet_length=43) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_parse.cc:1432
#24 0x00000000007de3c8 in do_command (thd=0x7fd426eaf000) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_parse.cc:1049
#25 0x00000000007a6385 in do_handle_one_connection (thd_arg=0x7fd426eaf000) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_connect.cc:1532
#26 0x00000000007a5e8d in handle_one_connection (arg=0x7fd426eaf000) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/sql_connect.cc:1443
#27 0x0000000000dc5590 in pfs_spawn_thread (arg=0x7fd4b9bb9f20) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/storage/perfschema/pfs.cc:1860
#28 0x00007fd4d5c1cdf3 in start_thread () from /lib64/libpthread.so.0
#29 0x00007fd4d48e601d in clone () from /lib64/libc.so.6
(gdb) +set logging off

***************** Error Info

mysqld: /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.21-69.0/sql/filesort.cc:1029: void make_sortkey(Sort_
param*, uchar*, uchar*): Assertion `sort_field->length >= length' failed.
12:44:11 UTC - mysqld got signal 6 ;
--
--
Thread pointer: 0x7fd426eaf000
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7fd4d6212e18 thread_stack 0x40000
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(my_print_stacktrace+0x35)[0xab6ee8]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(handle_fatal_signal+0x41a)[0x72f6a6]
/lib64/libpthread.so.0(+0xf130)[0x7fd4d5c24130]
/lib64/libc.so.6(gsignal+0x39)[0x7fd4d48255c9]
/lib64/libc.so.6(abort+0x148)[0x7fd4d4826cd8]
/lib64/libc.so.6(+0x2e536)[0x7fd4d481e536]
/lib64/libc.so.6(+0x2e5e2)[0x7fd4d481e5e2]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_Z12make_sortkeyP10Sort_paramPhS1_+0x2ca)[0x938f83]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld[0x9385d8]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_Z8filesortP3THDP5TABLEP8FilesortbPyS5_+0x8ca)[0x936d91]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld[0x7b80f7]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_ZN13st_join_table10sort_tableEv+0x121)[0x7b5ba9]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_Z21join_init_read_recordP13st_join_table+0x61)[0x7b5679]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x1b5)[0x7b2f23]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld[0x7b290d]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_ZN4JOIN4execEv+0x6a5)[0x7b0869]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld[0x813ebb]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_P10SQL_I_ListI8st_orderESB_S7_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x24c)[0x8141b7]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_Z13handle_selectP3THDP13select_resultm+0x1c4)[0x812246]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld[0x7ea732]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_Z21mysql_execute_commandP3THD+0xd9c)[0x7e2c89]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x5a6)[0x7ed033]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0xc88)[0x7df49c]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_Z10do_commandP3THD+0x3ac)[0x7de3c8]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(_Z24do_handle_one_connectionP3THD+0x1c4)[0x7a6385]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(handle_one_connection+0x33)[0x7a5e8d]
/ssd/ramesh/Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug/bin/mysqld(pfs_spawn_thread+0x159)[0xdc5590]
/lib64/libpthread.so.0(+0x7df3)[0x7fd4d5c1cdf3]
/lib64/libc.so.6(clone+0x6d)[0x7fd4d48e601d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7fd3dbc1f010): SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a)
Connection ID (thread ID): 1
Status: NOT_KILLED

*********** Testcase

create table t1(a set('a','a')not null) engine=csv;
insert into t1(a)values(1);
SET @@session.max_sort_length=4;
SET NAMES latin1 COLLATE latin1_german2_ci;
SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);

*********** Server Version

Percona-Server-5.6.21-rel69.0-671.Linux.x86_64-debug

upstream?

Ramesh Sivaraman (rameshvs02) wrote :

Fulll bundle with all files (core, gdb stacks, error log, datadir and more)

Ramesh Sivaraman (rameshvs02) wrote :

This issue is not upstream. I could not reproduce with MS.

I am able to reproduce with lp:mysql-server/5.6 rev 6130, debug build. How did you test upstream?

tags: added: upstream
Ramesh Sivaraman (rameshvs02) wrote :

I have used MS optimized build to reproduce testcase. Reproduced with MS debug build.

Logged upstream bug - http://bugs.mysql.com/bug.php?id=74260

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.