Bug #88798 Query_cache::end_of_result(THD*): Assertion `thd->stmt_da->is_eof()' failed.
Submitted: 7 Dec 2017 0:06 Modified: 25 Oct 2018 8:59
Reporter: Roel Van de Paar Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Query Cache Severity:S1 (Critical)
Version:5.5.58 OS:Any
Assigned to: CPU Architecture:Any

[7 Dec 2017 0:06] Roel Van de Paar
Description:
171207 10:36:10 [Note] /sda/MS091117-mysql-5.5.58-linux-x86_64-debug/bin/mysqld: ready for connections.
Version: '5.5.58-debug'  socket: '/sda/MS091117-mysql-5.5.58-linux-x86_64-debug/socket.sock'  port: 18611  MySQL Community Server (GPL)
171207 10:36:11 [ERROR] /sda/MS091117-mysql-5.5.58-linux-x86_64-debug/bin/mysqld: Out of sort memory, consider increasing server sort buffer size
171207 10:36:11 [ERROR] /sda/MS091117-mysql-5.5.58-linux-x86_64-debug/bin/mysqld: Sort aborted: Out of sort memory, consider increasing server sort buffer size
mysqld: /git/mysql-server_dbg/sql/sql_cache.cc:1000: void Query_cache::end_of_result(THD*): Assertion `thd->stmt_da->is_eof()' failed.
23:36:11 UTC - mysqld got signal 6 ;

How to repeat:
USE test;
SET @@global.sort_buffer_size=32777;
CREATE TABLE t1 (a mediumtext character set utf16);
set session max_sort_length=2180;
SET @@SESSION.sort_buffer_size=default;
SET GLOBAL query_cache_size=1048576;
SELECT * FROM (SELECT a,SUM(a) FROM t1 GROUP BY a WITH ROLLUP) as t;
SELECT 1;  # Shows server is gone
[7 Dec 2017 0:09] Roel Van de Paar
Core was generated by `/sda/MS091117-mysql-5.5.58-linux-x86_64-debug/bin/mysqld --no-defaults --core -'.
Program terminated with signal 6, Aborted.
#0  0x00007f9d279689b1 in __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
61	  val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
(gdb) bt
#0  0x00007f9d279689b1 in __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x00000000007dffb8 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.c:433
#2  0x00000000006a2f16 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:247
#3  <signal handler called>
#4  0x00007f9d2609e1f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f9d2609f8e8 in __GI_abort () at abort.c:90
#6  0x00007f9d26097266 in __assert_fail_base (fmt=0x7f9d261e9e68 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0xa4ab7b "thd->stmt_da->is_eof()", file=file@entry=0xa486f8 "/git/mysql-server_dbg/sql/sql_cache.cc", 
    line=line@entry=1000, 
    function=function@entry=0xa4ae80 <Query_cache::end_of_result(THD*)::__PRETTY_FUNCTION__> "void Query_cache::end_of_result(THD*)") at assert.c:92
#7  0x00007f9d26097312 in __GI___assert_fail (assertion=0xa4ab7b "thd->stmt_da->is_eof()", 
    file=0xa486f8 "/git/mysql-server_dbg/sql/sql_cache.cc", line=1000, 
    function=0xa4ae80 <Query_cache::end_of_result(THD*)::__PRETTY_FUNCTION__> "void Query_cache::end_of_result(THD*)")
    at assert.c:101
#8  0x000000000055c799 in Query_cache::end_of_result (this=0x10fcfe0 <query_cache>, thd=thd@entry=0x7f9d18b89000)
    at /git/mysql-server_dbg/sql/sql_cache.cc:1000
#9  0x0000000000596a79 in dispatch_command (command=<optimized out>, command@entry=COM_QUERY, thd=thd@entry=0x7f9d18b89000, 
    packet=<optimized out>, packet@entry=0x7f9d18b80001 "", packet_length=packet_length@entry=67)
    at /git/mysql-server_dbg/sql/sql_parse.cc:1461
#10 0x0000000000597836 in do_command (thd=0x7f9d18b89000) at /git/mysql-server_dbg/sql/sql_parse.cc:776
#11 0x000000000063fd82 in do_handle_one_connection (thd_arg=thd_arg@entry=0x7f9d18b89000)
    at /git/mysql-server_dbg/sql/sql_connect.cc:870
#12 0x000000000063fe3f in handle_one_connection (arg=0x7f9d18b89000) at /git/mysql-server_dbg/sql/sql_connect.cc:789
#13 0x00007f9d27963e25 in start_thread (arg=0x7f9d27f5d700) at pthread_create.c:308
#14 0x00007f9d2616134d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
[7 Dec 2017 12:32] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Observed that 5.5.58 debug build is affected.
5.6.38/5.7.20 - not affected with provided test case.

Thanks,
Umesh
[25 Oct 2018 8:59] Erlend Dahl
We will not fix this, as it is relevant for 5.5 only. The query cache was removed by WL#10824 in 8.0 and up.