Bug #97404 Assertion "temptable..Handler..get_error_message"
Submitted: 28 Oct 2019 18:57 Modified: 12 Dec 2019 2:06
Reporter: Hrvoje Matijakovic Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Information schema Severity:S6 (Debug Builds)
Version:8.0.18, 8.0.17 OS:Linux
Assigned to: CPU Architecture:x86
Tags: regression

[28 Oct 2019 18:57] Hrvoje Matijakovic
Description:
Following sql results in a crash with the debug build (can't reproduce it on release build).

gdb from the debug build:

Core was generated by `/sdc/MS151019-mysql-8.0.18-linux-x86_64-debug/bin/mysqld --no-defaults --basedi'.
Program terminated with signal 6, Aborted.
#0  0x00007fce7d097a61 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:59
59        val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
(gdb) bt
+bt
#0  0x00007fce7d097a61 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:59
#1  0x00000000048f003d in my_write_core (sig=6) at /sdc/MS-8.0.18_dbg/mysys/stacktrace.cc:305
#2  0x00000000035e030e in handle_fatal_signal (sig=6) at /sdc/MS-8.0.18_dbg/sql/signal_handler.cc:169
#3  <signal handler called>
#4  0x00007fce7aedf337 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:55
#5  0x00007fce7aee0a28 in __GI_abort () at abort.c:90
#6  0x000000000516a6ea in temptable::Handler::init_table_handle_for_HANDLER (this=0x7fce21a5f028) at /sdc/MS-8.0.18_dbg/storage/temptable/src/handler.cc:1137
#7  0x000000000333449a in lock_tables (thd=0x7fce21820000, tables=0x7fce21872e28, count=7, flags=0) at /sdc/MS-8.0.18_dbg/sql/sql_base.cc:6672
#8  0x0000000003475e94 in Sql_cmd_dml::execute (this=0x7fce218733d8, thd=0x7fce21820000) at /sdc/MS-8.0.18_dbg/sql/sql_select.cc:700
#9  0x0000000003413287 in mysql_execute_command (thd=0x7fce21820000, first_level=true) at /sdc/MS-8.0.18_dbg/sql/sql_parse.cc:4453
#10 0x0000000003415bb6 in mysql_parse (thd=0x7fce21820000, parser_state=0x7fce647fcae0) at /sdc/MS-8.0.18_dbg/sql/sql_parse.cc:5257
#11 0x000000000340b046 in dispatch_command (thd=0x7fce21820000, com_data=0x7fce647fdb90, command=COM_QUERY) at /sdc/MS-8.0.18_dbg/sql/sql_parse.cc:1765
#12 0x000000000340958b in do_command (thd=0x7fce21820000) at /sdc/MS-8.0.18_dbg/sql/sql_parse.cc:1273
#13 0x00000000035caf99 in handle_connection (arg=0x7fce2c87a3e0) at /sdc/MS-8.0.18_dbg/sql/conn_handler/connection_handler_per_thread.cc:302
#14 0x00000000050ac3c0 in pfs_spawn_thread (arg=0x7fce7906a6e0) at /sdc/MS-8.0.18_dbg/storage/perfschema/pfs.cc:2854
#15 0x00007fce7d092e65 in start_thread (arg=0x7fce647fe700) at pthread_create.c:307
#16 0x00007fce7afa788d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb)

How to repeat:
SET @@SESSION.optimizer_switch="derived_merge=off";
lock table mysql.user write;
SELECT * FROM information_schema.ST_GEOMETRY_COLUMNS;
[29 Oct 2019 5:59] MySQL Verification Team
Hello Hrvoje Matijakovic,

Thank you for the bug report and test case.
Verified as described on 8.0.18 debug build.

regards,
Umesh
[12 Dec 2019 2:06] Paul DuBois
Posted by developer:
 
Fixed in 8.0.20.

For debug builds, under LOCK TABLES, the server could mishandle
materialized temporary tables and raise an assertion.