Details
Description
Likely cause: commit 6e086ce2a3a8448a5daf4f7e8117752c443bb83f (MDEV-34391), in Sql_path_instant_set::~Sql_path_instant_set(). It is not a regression: CS 12.3.1, the first release with SET PATH, has the commit.
--source include/not_embedded.inc
|
|
|
CREATE VIEW v1 AS SELECT 1 AS a; |
CREATE TABLE t1 (a INT); |
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a= NEW.a + 1; |
--let DATADIR= `SELECT @@datadir`
|
--perl
|
my %new= ("v1.frm" => "sql_path=`x", "t1.TRG" => "sql_path='`x'"); |
foreach my $n (keys %new) {
|
my $f= "$ENV{DATADIR}/test/$n"; |
open(my $in, '<', $f) or die "open $f: $!"; |
my @l= <$in>; |
close $in; |
s/^sql_path=.*$/$new{$n}/ for @l; |
open(my $out, '>', $f) or die "write $f: $!"; |
print $out @l; |
close $out; |
}
|
EOF
|
FLUSH TABLES;
|
|
|
--disable_abort_on_error
|
SELECT * FROM v1; |
--let $e1= $mysql_errno
|
INSERT INTO t1 VALUES (1); |
--let $e2= $mysql_errno
|
--enable_abort_on_error
|
if ($e1 == 2013) { |
--die The server crashed on opening a view whose stored path does not parse |
}
|
if ($e2 == 2013) { |
--die The server crashed on loading a trigger whose stored path does not parse |
}
|
|
|
DROP VIEW v1; |
DROP TABLE t1; |
Leads to:
|
CS 13.1.2 87e62ca17270e163a6d41b3fc8d6f4d440f1bb88 (Optimized, Clang 22.1.8-20260622) Build 05/10/2026 |
Core was generated by `/data/claude_sqlpath/MD051026-mariadb-13.1.2-linux-x86_64-opt/bin/mariadbd --de'.
|
Program terminated with signal SIGSEGV, Segmentation fault.
|
#0 0x00005c30d1a66133 in std::max<unsigned int> (__a=<error reading variable: Cannot access memory at address 0xf30>, __b=@0x7fb638545788: 0)at /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_algobase.h:262
|
262 if (__a < __b)
|
[Current thread is 1 (LWP 3166144)]
|
(gdb) bt
|
#0 0x00005c30d1a66133 in std::max<unsigned int> (__a=<error reading variable: Cannot access memory at address 0xf30>, __b=@0x7fb638545788: 0)at /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_algobase.h:262
|
#1 Sql_path::set (this=<optimized out>, rhs=@0x7fb638545688: {m_schemas = {{<Lex_ident_fs> = {<Lex_ident<Compare_table_names>> = {<Lex_cstring> = {<st_mysql_const_lex_string> = {str = 0x7fb61c00ced0 "xxoc", length = 0}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, {<Lex_ident_fs> = {<Lex_ident<Compare_table_names>> = {<Lex_cstring> = {<st_mysql_const_lex_string> = {str = 0x0, length = 0}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>} <repeats 15 times>}, m_count = 0}) at /test/13.1_opt/sql/sql_path.cc:304
|
#2 Sql_path_instant_set::~Sql_path_instant_set (this=this@entry=0x7fb638545680) at /test/13.1_opt/sql/sql_path.cc:576
|
#3 0x00005c30d1c146b6 in mysql_make_view (thd=thd@entry=0x7fb61c000c70, share=share@entry=0x7fb61c25ece0, view_table_alias=view_table_alias@entry=0x7fb61c013de0, open_view_no_parse=<optimized out>) at /test/13.1_opt/sql/sql_view.cc:1555
|
#4 0x00005c30d1aba4fd in open_table (thd=thd@entry=0x7fb61c000c70, table_list=table_list@entry=0x7fb61c013de0, ot_ctx=ot_ctx@entry=0x7fb6385459e0) at /test/13.1_opt/sql/sql_base.cc:2225
|
#5 0x00005c30d1abce88 in open_and_process_table (thd=0x7fb61c000c70, tables=0x7fb61c013de0, counter=0x7fb638545a9c, flags=0, prelocking_strategy=0x7fb638545b00, ot_ctx=0x7fb6385459e0, has_prelocking_list=<optimized out>) at /test/13.1_opt/sql/sql_base.cc:4306
|
#6 open_tables (thd=thd@entry=0x7fb61c000c70, options=@0x7fb61c00684c: {m_options = DDL_options_st::OPT_NONE}, start=start@entry=0x7fb638545a90, counter=counter@entry=0x7fb638545a9c, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x7fb638545b00)at /test/13.1_opt/sql/sql_base.cc:4789
|
#7 0x00005c30d1abe804 in open_and_lock_tables (thd=0x7fb638545680, thd@entry=0x7fb61c000c70, options=@0x7fb61c0343e0: {m_options = (DDL_options_st::OPT_OR_REPLACE | unknown: 0x2000)}, tables=0x7fb61c013de0, derived=true, flags=469764320, flags@entry=0, prelocking_strategy=0x7, prelocking_strategy@entry=0x7fb638545b00)at /test/13.1_opt/sql/sql_base.cc:5816
|
#8 0x00005c30d1b33c47 in open_and_lock_tables (thd=0x7fb61c000c70, tables=0x7fb61c013de0, derived=true, flags=0)at /test/13.1_opt/sql/sql_base.h:545
|
#9 execute_sqlcom_select (thd=thd@entry=0x7fb61c000c70, all_tables=0x7fb61c013de0) at /test/13.1_opt/sql/sql_parse.cc:6136
|
#10 0x00005c30d1b2f7d7 in mysql_execute_command (thd=thd@entry=0x7fb61c000c70, is_called_from_prepared_stmt=false) at /test/13.1_opt/sql/sql_parse.cc:3989
|
#11 0x00005c30d1b2aa8d in mysql_parse (thd=thd@entry=0x7fb61c000c70, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fb6385464e0)at /test/13.1_opt/sql/sql_parse.cc:7955
|
#12 0x00005c30d1b2925d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fb61c000c70, packet=packet@entry=0x7fb61c008ea1 "SELECT * FROM v1", packet_length=packet_length@entry=16, blocking=true)at /test/13.1_opt/sql/sql_parse.cc:1903
|
#13 0x00005c30d1b2af10 in do_command (thd=thd@entry=0x7fb61c000c70, blocking=true) at /test/13.1_opt/sql/sql_parse.cc:1437
|
#14 0x00005c30d1c5784d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5c310f60b570, put_in_cache=true)at /test/13.1_opt/sql/sql_connect.cc:1514
|
#15 0x00005c30d1c57682 in handle_one_connection (arg=arg@entry=0x5c310f60b570)at /test/13.1_opt/sql/sql_connect.cc:1426
|
#16 0x00005c30d2005683 in pfs_spawn_thread (arg=0x5c310fcc73d0)at /test/13.1_opt/storage/perfschema/pfs.cc:2198
|
#17 0x00007fb63f09cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
|
#18 0x00007fb63f129ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
|
When only t1.TRG is changed, the INSERT gives the same crash, from Table_triggers_list::check_n_load().
From the code it seems that the Sql_path_instant_set constructor that parses the stored path sets m_thd to NULL when Sql_path::from_text() fails, and that the destructor then uses m_thd without a check. A path that the server writes seems to always parse, so this needs a damaged or edited .frm or .TRG file.
Attachments
Issue Links
- is caused by
-
MDEV-34391 SET PATH statement
-
- Closed
-