[MDEV-30801] SIGABRT in trx_start_if_not_started_low on SELECT after XA Created: 2023-03-07  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, XA
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0
Fix Version/s: 10.4, 10.5, 10.6, 10.11

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Nikita Malyavin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-22445 Crash on HANDLER READ NEXT after XA P... Closed

 Description   

Similar to the previously fixed MDEV-22445, we have:

SET GLOBAL query_cache_type=1;
SET SESSION query_cache_type=ON;
CREATE TABLE t (c INT) ENGINE=InnoDB;
XA START 'a';
SELECT * FROM t;
XA END 'a';
XA PREPARE 'a';
SELECT * FROM t;

Leads to:

11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Optimized)

Core was generated by `/test/MD180223-mariadb-11.0.1-linux-x86_64-opt/bin/mariadbd --no-defaults --cor'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23194195240512)
    at ./nptl/pthread_kill.c:44
[Current thread is 1 (Thread 0x151851c4a640 (LWP 3257219))]
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23194195240512) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=23194195240512) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=23194195240512, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x000015186f2d1476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x000015186f2b77f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x0000560242730c8e in ut_dbg_assertion_failed (expr=expr@entry=0x0, file=file@entry=0x5602432fe0e8 "/test/11.0_opt/storage/innobase/trx/trx0trx.cc", line=line@entry=2129) at /test/11.0_opt/storage/innobase/ut/ut0dbg.cc:60
#6  0x000056024272f859 in trx_start_if_not_started_low (trx=<optimized out>, read_write=<optimized out>) at /test/11.0_opt/storage/innobase/trx/trx0trx.cc:2129
#7  0x0000560242d70b8e in innobase_query_caching_table_check (norm_name=0x151851c47cb0 "test/t", trx=0x151866a51b80) at /test/11.0_opt/storage/innobase/handler/ha_innodb.cc:3176
#8  innobase_query_caching_of_table_permitted (thd=<optimized out>, full_name=<optimized out>, full_name_len=<optimized out>) at /test/11.0_opt/storage/innobase/handler/ha_innodb.cc:3271
#9  0x000056024283cfa3 in Query_cache::send_result_to_client (this=0x560243a3b120 <query_cache>, thd=thd@entry=0x1517f0000c68, org_sql=org_sql@entry=0x1517f0010770 "SELECT * FROM t", query_length=<optimized out>, query_length@entry=15) at /test/11.0_opt/sql/sql_cache.h:228
#10 0x00005602428a5658 in mysql_parse (thd=0x1517f0000c68, rawbuf=0x1517f0010770 "SELECT * FROM t", length=15, parser_state=0x151851c48c80) at /test/11.0_opt/sql/sql_parse.cc:7950
#11 0x00005602428a7d72 in dispatch_command (command=COM_QUERY, thd=0x1517f0000c68, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/11.0_opt/sql/sql_parse.cc:1991
#12 0x00005602428a9510 in do_command (thd=0x1517f0000c68, blocking=blocking@entry=true) at /test/11.0_opt/sql/sql_parse.cc:1407
#13 0x00005602429c1717 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x560245165be8, put_in_cache=put_in_cache@entry=true) at /test/11.0_opt/sql/sql_connect.cc:1416
#14 0x00005602429c19ed in handle_one_connection (arg=0x560245165be8) at /test/11.0_opt/sql/sql_connect.cc:1318
#15 0x000015186f323b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#16 0x000015186f3b5a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Bug confirmed present in:
MariaDB: 10.3.38 (dbg), 10.3.38 (opt), 10.4.29 (dbg), 10.4.29 (opt), 10.5.20 (dbg), 10.5.20 (opt), 10.6.13 (dbg), 10.6.13 (opt), 10.7.8 (dbg), 10.7.8 (opt), 10.8.8 (dbg), 10.8.8 (opt), 10.9.6 (dbg), 10.9.6 (opt), 10.10.4 (dbg), 10.10.4 (opt), 10.11.2 (dbg), 10.11.2 (opt), 11.0.1 (dbg), 11.0.1 (opt)

Bug (or feature/syntax) confirmed not present in:
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.40 (dbg), 5.7.40 (opt), 8.0.31 (dbg), 8.0.31 (opt)



 Comments   
Comment by Roel Van de Paar [ 2023-03-07 ]

Interestingly,

11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Optimized)

11.0.1-opt>SET GLOBAL query_cache_type=1, SESSION query_cache_type=ON;
ERROR 1925 (HY000): Query cache is globally disabled and you can't enable it only for this session

Versus

11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Optimized)

11.0.1-opt>SET GLOBAL query_cache_type=1;
Query OK, 0 rows affected (0.000 sec)
 
11.0.1-opt>SET SESSION query_cache_type=ON;
Query OK, 0 rows affected (0.000 sec)

Generated at Thu Feb 08 10:18:59 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.