Bug #112521 Abort in /mysql-8.0.34/sql/signal_handler.cc:286
Submitted: 26 Sep 2023 12:40 Modified: 26 Sep 2023 13:06
Reporter: xin wen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S6 (Debug Builds)
Version:8.0.34 OS:Ubuntu (20.04)
Assigned to: CPU Architecture:Any

[26 Sep 2023 12:40] xin wen
Description:
Run these queries:

CREATE TABLE t0 ( c13 INT , c39 INT ) ;
INSERT INTO t0 SET c13 = -27 ;
CREATE VIEW v0 AS SELECT REVERSE ( c13 ) * LAG ( c13 , 1513851253354973910 ) OVER ( ) AS c40 FROM ( SELECT c13 AS c6 FROM t0 ) AS t1 JOIN t0 ON t0 . c13 = t0 . c13 INTERSECT SELECT c39 AS c6 FROM t0 ;
WITH t2 AS ( SELECT -126 AS c13 , -76 AS c14 ) SELECT RAND ( ) - FLOOR ( c47 ) IS NOT FALSE AS c46 , 56 BETWEEN AVG ( 5037955339126189160 ) AND 46 AS c38 FROM ( SELECT c13 AS c22 FROM t2 ) AS t3 JOIN ( SELECT c40 AS c47 FROM v0 ) AS t4 ON c22 = c47 GROUP BY c47 ;

Will trigger abort.

GDB info:
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff6af2859 in __GI_abort () at abort.c:79
#2  0x00005555598c0230 in my_server_abort () at /home/wx/mysql-8.0.34/sql/signal_handler.cc:286
#3  0x000055555be424d3 in my_abort () at /home/wx/mysql-8.0.34/mysys/my_init.cc:258
#4  0x000055555cda03ac in temptable::Handler::index_first (this=<optimized out>) at /home/wx/mysql-8.0.34/storage/temptable/src/handler.cc:964
#5  0x0000555559baaa74 in handler::ha_index_first (this=0x622000373930, buf=<optimized out>) at /home/wx/mysql-8.0.34/sql/handler.cc:3418
#6  0x0000555559ecac64 in IndexScanIterator<false>::Read (this=0x60b000157d20) at /home/wx/mysql-8.0.34/sql/iterators/basic_row_iterators.cc:103
#7  0x000055555a29b198 in MaterializeIterator<DummyIteratorProfiler>::Read (this=0x6110001145b0) at /home/wx/mysql-8.0.34/sql/iterators/composite_iterators.cc:1413
#8  0x000055555a2939ac in FilterIterator::Read (this=0x6070003ae490) at /home/wx/mysql-8.0.34/sql/iterators/composite_iterators.cc:76
#9  0x000055555a29464f in AggregateIterator::Read (this=0x61800005d4b0) at /home/wx/mysql-8.0.34/sql/iterators/composite_iterators.cc:241
#10 0x0000555559713b95 in Query_expression::ExecuteIteratorQuery (this=this@entry=0x612000315070, thd=thd@entry=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_union.cc:1770
#11 0x0000555559713ecd in Query_expression::execute (this=this@entry=0x612000315070, thd=thd@entry=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_union.cc:1823
#12 0x00005555595b1f79 in Sql_cmd_dml::execute_inner (this=0x60b000156a90, thd=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_select.cc:1022
#13 0x00005555595ce209 in Sql_cmd_dml::execute (this=0x60b000156a90, thd=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_select.cc:793
#14 0x00005555594bd568 in mysql_execute_command (thd=thd@entry=0x6270002bf900, first_level=first_level@entry=true) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:4719
#15 0x00005555594c0bfe in dispatch_sql_command (thd=0x6270002bf900, parser_state=parser_state@entry=0x7fffc706ec00) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:5368
#16 0x00005555594c38e2 in dispatch_command (thd=thd@entry=0x6270002bf900, com_data=com_data@entry=0x7fffc7070200, command=<optimized out>) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:2054
#17 0x00005555594c7392 in do_command (thd=thd@entry=0x6270002bf900) at /home/wx/mysql-8.0.34/sql/sql_parse.cc:1439
#18 0x000055555989b7be in handle_connection (arg=arg@entry=0x60300018caf0) at /home/wx/mysql-8.0.34/sql/conn_handler/connection_handler_per_thread.cc:302
#19 0x000055555cc724e9 in pfs_spawn_thread (arg=0x614000140a60) at /home/wx/mysql-8.0.34/storage/perfschema/pfs.cc:3042
#20 0x00007ffff7568609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#21 0x00007ffff6bef133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
Run the queries above.
[26 Sep 2023 13:06] MySQL Verification Team
Hello xin wen,

Thank you for the report and test case.
Observed that 8.0.34 debug build is affected.

regards,
Umesh
[26 Sep 2023 13:06] MySQL Verification Team
-
./mtr --nocheck-testcases bug112521 --debug-server
Logging: ./mtr  --nocheck-testcases bug112521 --debug-server
MySQL Version 8.0.34
Checking supported features
 - Binaries are debug compiled
Using 'all' suites
Collecting tests
Checking leftover processes
Removing old var directory
Creating var directory '/export/home/tmp/ushastry/mysql-8.0.34/mysql-test/var'
Installing system database
Using parallel: 1

==============================================================================
                  TEST NAME                       RESULT  TIME (ms) COMMENT
------------------------------------------------------------------------------
CREATE TABLE t0 ( c13 INT , c39 INT ) ;
INSERT INTO t0 SET c13 = -27 ;
CREATE VIEW v0 AS SELECT REVERSE ( c13 ) * LAG ( c13 , 1513851253354973910 ) OVER ( ) AS c40 FROM ( SELECT c13 AS c6 FROM t0 ) AS t1 JOIN t0 ON t0 . c13 = t0 . c13 INTERSECT SELECT c39 AS c6 FROM t0 ;
WITH t2 AS ( SELECT -126 AS c13 , -76 AS c14 ) SELECT RAND ( ) - FLOOR ( c47 ) IS NOT FALSE AS c46 , 56 BETWEEN AVG ( 5037955339126189160 ) AND 46 AS c38 FROM ( SELECT c13 AS c22 FROM t2 ) AS t3 JOIN ( SELECT c40 AS c47 FROM v0 ) AS t4 ON c22 = c47 GROUP BY c47 ;
[ 50%] main.bug112521                            [ fail ]
        Test ended at 2023-09-26 15:05:36

CURRENT_TEST: main.bug112521
mysqltest: At line 4: Query 'WITH t2 AS ( SELECT -126 AS c13 , -76 AS c14 ) SELECT RAND ( ) - FLOOR ( c47 ) IS NOT FALSE AS c46 , 56 BETWEEN AVG ( 5037955339126189160 ) AND 46 AS c38 FROM ( SELECT c13 AS c22 FROM t2 ) AS t3 JOIN ( SELECT c40 AS c47 FROM v0 ) AS t4 ON c22 = c47 GROUP BY c47 ' failed.
ERROR 2013 (HY000): Lost connection to MySQL server during query

-bt

#0  0x00007f34ab842aa1 in pthread_kill () from /lib64/libpthread.so.0
#1  0x000000000402c28e in my_write_core(int) ()
#2  0x00000000032d235e in handle_fatal_signal ()
#3  <signal handler called>
#4  0x00007f34a9b8d387 in raise () from /lib64/libc.so.6
#5  0x00007f34a9b8ea78 in abort () from /lib64/libc.so.6
#6  0x00000000032d2452 in my_server_abort() ()
#7  0x00000000040263cd in my_abort() ()
#8  0x0000000004864d23 in temptable::Handler::index_first(unsigned char*) ()
#9  0x00000000033e27cc in handler::ha_index_first(unsigned char*) ()
#10 0x00000000034ff6da in IndexScanIterator<false>::Read() ()
#11 0x0000000003669356 in MaterializeIterator<DummyIteratorProfiler>::Read() ()
#12 0x0000000003666c33 in FilterIterator::Read() ()
#13 0x0000000003667032 in AggregateIterator::Read() ()
#14 0x000000000322d193 in Query_expression::ExecuteIteratorQuery(THD*) ()
#15 0x000000000322d2aa in Query_expression::execute(THD*) ()
#16 0x00000000031b71dc in Sql_cmd_dml::execute_inner(THD*) ()
#17 0x00000000031c0beb in Sql_cmd_dml::execute(THD*) ()
#18 0x0000000003161263 in mysql_execute_command(THD*, bool) ()
#19 0x00000000031626a2 in dispatch_sql_command(THD*, Parser_state*) ()
#20 0x0000000003163cd5 in dispatch_command(THD*, COM_DATA const*, enum_server_command) ()
#21 0x000000000316596c in do_command(THD*) ()
#22 0x00000000032c437c in handle_connection ()
#23 0x00000000047e1af5 in pfs_spawn_thread ()
#24 0x00007f34ab83dea5 in start_thread () from /lib64/libpthread.so.0
#25 0x00007f34a9c55b2d in clone () from /lib64/libc.so.6