Bug #88571 void Query_cache::end_of_result(THD*): Assertion `0' failed. w/ event scheduler
Submitted: 21 Nov 2017 2:23 Modified: 25 Oct 2018 8:57
Reporter: Roel Van de Paar Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Query Cache Severity:S6 (Debug Builds)
Version:5.5.58 OS:Any
Assigned to: CPU Architecture:Any

[21 Nov 2017 2:23] Roel Van de Paar
Description:
Version: '5.5.58-debug'  socket: '/sda/MS091117-mysql-5.5.58-linux-x86_64-debug/socket.sock'  port: 10231  MySQL Community Server (GPL)
171121 12:40:25 [Note] Event Scheduler: scheduler thread started with id 3
mysqld: /git/mysql-server_dbg/sql/sql_cache.cc:1041: void Query_cache::end_of_result(THD*): Assertion `0' failed.
01:40:25 UTC - mysqld got signal 6 ;

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  0x00007fab76d449b1 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  0x00007fab76d449b1 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  0x00007fab7547a1f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007fab7547b8e8 in __GI_abort () at abort.c:90
#6  0x00007fab75473266 in __assert_fail_base (fmt=0x7fab755c5e68 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0xad6237 "0", file=file@entry=0xa486f8 "/git/mysql-server_dbg/sql/sql_cache.cc", 
    line=line@entry=1041, 
    function=function@entry=0xa4ae80 <Query_cache::end_of_result(THD*)::__PRETTY_FUNCTION__> "void Query_cache::end_of_result(THD*)") at assert.c:92
#7  0x00007fab75473312 in __GI___assert_fail (assertion=0xad6237 "0", file=0xa486f8 "/git/mysql-server_dbg/sql/sql_cache.cc", 
    line=1041, function=0xa4ae80 <Query_cache::end_of_result(THD*)::__PRETTY_FUNCTION__> "void Query_cache::end_of_result(THD*)")
    at assert.c:101
#8  0x000000000055ca2c in Query_cache::end_of_result (this=0x10fcfe0 <query_cache>, thd=thd@entry=0x7fab54828000)
    at /git/mysql-server_dbg/sql/sql_cache.cc:1041
#9  0x00000000007876dd in sp_instr_stmt::execute (this=<optimized out>, thd=0x7fab54828000, nextp=0x7fab772b6534)
    at /git/mysql-server_dbg/sql/sp_head.cc:3151
#10 0x0000000000783529 in sp_head::execute (this=this@entry=0x7fab54c21010, thd=thd@entry=0x7fab54828000, 
    merge_da_on_success=merge_da_on_success@entry=true) at /git/mysql-server_dbg/sql/sp_head.cc:1435
#11 0x0000000000784f61 in sp_head::execute_procedure (this=this@entry=0x7fab54c21010, thd=thd@entry=0x7fab54828000, 
    args=args@entry=0x7fab772b68b0) at /git/mysql-server_dbg/sql/sp_head.cc:2199
#12 0x0000000000628a75 in Event_job_data::execute (this=this@entry=0x7fab772b6ca0, thd=thd@entry=0x7fab54828000, 
    drop=<optimized out>) at /git/mysql-server_dbg/sql/event_data_objects.cc:1434
#13 0x00000000007b8ef2 in Event_worker_thread::run (this=this@entry=0x7fab772b6daf, thd=thd@entry=0x7fab54828000, 
    event=event@entry=0x7fab54814040) at /git/mysql-server_dbg/sql/event_scheduler.cc:325
#14 0x00000000007b900f in event_worker_thread (arg=0x7fab54814040) at /git/mysql-server_dbg/sql/event_scheduler.cc:282
#15 0x00007fab76d3fe25 in start_thread (arg=0x7fab772b7700) at pthread_create.c:308
#16 0x00007fab7553d34d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
USE test;
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1;
SET @@global.query_cache_size=1355776;
create table t1(f1 int key,f2 BLOB,f3 BLOB)engine=InnoDB;
set global event_scheduler=1;
SELECT 1;  # Shows server is gone
[21 Nov 2017 2:30] Roel Van de Paar
Any connection with bug 81446 or bug 81412 ?
[21 Nov 2017 6:22] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Observed that only 5.5.58 debug build is affected with the provided test case.

Thanks,
Umesh
[21 Nov 2017 6:25] MySQL Verification Team
-- 5.5.58 - only debug build affected with provided test case

rm -rf 88571
scripts/mysql_install_db --basedir=$PWD --datadir=$PWD/88571
bin/mysqld-debug --no-defaults --basedir=$PWD --datadir=$PWD/88571 --core-file --socket=/tmp/mysql_ushastry.sock  --port=3306 --log-error=$PWD/88571/log.err 2>&1 &

(gdb) bt
#0  0x00007f8d8b8e9771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000007dea99 in my_write_core (sig=6) at /export/home/pb2/build/sb_0-24964184-1505323531.85/mysql-5.5.58/mysys/stacktrace.c:433
#2  0x00000000006a6b6a in handle_fatal_signal (sig=6) at /export/home/pb2/build/sb_0-24964184-1505323531.85/mysql-5.5.58/sql/signal_handler.cc:247
#3  <signal handler called>
#4  0x00007f8d8a7055d7 in raise () from /lib64/libc.so.6
#5  0x00007f8d8a706cc8 in abort () from /lib64/libc.so.6
#6  0x00007f8d8a6fe546 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f8d8a6fe5f2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000000568d28 in Query_cache::end_of_result (this=0x11273a0 <query_cache>, thd=0x7f8d68000b40)
    at /export/home/pb2/build/sb_0-24964184-1505323531.85/mysql-5.5.58/sql/sql_cache.cc:1041
#9  0x00000000007871b1 in sp_instr_stmt::execute (this=0x7f8d5c002d80, thd=0x7f8d68000b40, nextp=0x7f8d8828b8f8)
    at /export/home/pb2/build/sb_0-24964184-1505323531.85/mysql-5.5.58/sql/sp_head.cc:3151
#10 0x0000000000784232 in sp_head::execute (this=0x7f8d5c000ee0, thd=0x7f8d68000b40, merge_da_on_success=true)
    at /export/home/pb2/build/sb_0-24964184-1505323531.85/mysql-5.5.58/sql/sp_head.cc:1435
#11 0x00000000007858bd in sp_head::execute_procedure (this=0x7f8d5c000ee0, thd=<optimized out>, args=0x7f8d8828bd20)
    at /export/home/pb2/build/sb_0-24964184-1505323531.85/mysql-5.5.58/sql/sp_head.cc:2199
#12 0x000000000062cae1 in Event_job_data::execute (this=0x7f8d8828bdb0, thd=0x7f8d68000b40, drop=false)
    at /export/home/pb2/build/sb_0-24964184-1505323531.85/mysql-5.5.58/sql/event_data_objects.cc:1434
#13 0x00000000007b8f83 in Event_worker_thread::run (this=0x7f8d8828beef, thd=0x7f8d68000b40, event=0x7f8d68000a00)
    at /export/home/pb2/build/sb_0-24964184-1505323531.85/mysql-5.5.58/sql/event_scheduler.cc:325
#14 0x00000000007b90a9 in event_worker_thread (arg=0x7f8d68000a00) at /export/home/pb2/build/sb_0-24964184-1505323531.85/mysql-5.5.58/sql/event_scheduler.cc:282
#15 0x00007f8d8b8e4df5 in start_thread () from /lib64/libpthread.so.0
#16 0x00007f8d8a7c660d in clone () from /lib64/libc.so.6
(gdb)

##
5.6.38/5.7.20(even after enabling query cache in 5.7) - release/debug not affected with provided test case
[21 Nov 2017 9:09] MySQL Verification Team
https://bugs.mysql.com/bug.php?id=47378
https://bugs.mysql.com/bug.php?id=83188
[25 Oct 2018 8:57] Erlend Dahl
We will not fix this, as it is relevant for 5.5 only.

Also, the query cache was removed by WL#10824 in 8.0 and up.