Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.4, 11.8, 12.0
Description
Ref MDEV-35072.
--source include/have_innodb.inc
|
SET sql_select_limit=1,optimizer_join_limit_pref_ratio=1; |
CREATE TABLE t (c INT NOT NULL UNIQUE) ENGINE=InnoDB; |
INSERT INTO t VALUES (0),(1),(2),(3),(4),(5); |
SELECT * FROM t ORDER BY c; |
Leads to:
CS 11.8.1 33e0796e7a154e02a5e53c55cefc5d6feb4f5e6d (Debug, UBASAN, Clang) Build 15/02/2025 |
mariadbd: /test/11.8_dbg_san/sql/sql_select.cc:11723: double recompute_join_cost_with_limit(const JOIN *, bool, double *, double): Assertion `partial_join_cost >= 0.0' failed.
|
CS 11.8.1 33e0796e7a154e02a5e53c55cefc5d6feb4f5e6d (Debug, UBASAN, Clang) Build 15/02/2025 |
Core was generated by `/test/UBASAN_MD150225-mariadb-11.8.1-linux-x86_64-dbg/bin/mariadbd --no-default'.
|
Program terminated with signal SIGABRT, Aborted.
|
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
|
|
[Current thread is 1 (LWP 2021717)]
|
(gdb) bt
|
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
|
#1 __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
|
#2 __GI___pthread_kill (threadid=<optimized out>, signo=6)at ./nptl/pthread_kill.c:89
|
#3 0x000055f8965a2ac5 in handle_fatal_signal (sig=<optimized out>)at /test/11.8_dbg_san/sql/signal_handler.cc:298
|
#4 <signal handler called>
|
#5 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
|
#6 __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
|
#7 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
|
#8 0x000014a7d144526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
|
#9 0x000014a7d14288ff in __GI_abort () at ./stdlib/abort.c:79
|
#10 0x000014a7d142881b in __assert_fail_base (fmt=0x14a7d15d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55f898810200 <str> "partial_join_cost >= 0.0", file=file@entry=0x55f898809c54 "/test/11.8_dbg_san/sql/sql_select.cc", line=line@entry=11723, function=function@entry=0x55f898810240 <__PRETTY_FUNCTION__._Z30recompute_join_cost_with_limitPK4JOINbPdd> "double recompute_join_cost_with_limit(const JOIN *, bool, double *, double)") at ./assert/assert.c:94
|
#11 0x000014a7d143b507 in __assert_fail (assertion=0x55f898810200 <str> "partial_join_cost >= 0.0", file=0x55f898809c54 "/test/11.8_dbg_san/sql/sql_select.cc", line=11723, function=0x55f898810240 <__PRETTY_FUNCTION__._Z30recompute_join_cost_with_limitPK4JOINbPdd> "double recompute_join_cost_with_limit(const JOIN *, bool, double *, double)") at ./assert/assert.c:103
|
#12 0x000055f895957c58 in recompute_join_cost_with_limit (join=join@entry=0x52d0003c1e10, skip_sorting=<optimized out>, first_table_cost=first_table_cost@entry=0x14a79ff144b0, fraction=fraction@entry=0.16666666666666666)at /test/11.8_dbg_san/sql/sql_select.cc:11723
|
#13 0x000055f89594f489 in join_limit_shortcut_finalize_plan (join=0x52d0003c1e10, cost=<optimized out>)at /test/11.8_dbg_san/sql/sql_select.cc:11793
|
#14 0x000055f89594c5e6 in choose_plan (join=0x52d0003c1e10, join_tables=<optimized out>, emb_sjm_nest=<optimized out>)at /test/11.8_dbg_san/sql/sql_select.cc:10216
|
#15 0x000055f8958db1a1 in make_join_statistics (join=0x52d0003c1e10, tables_list=<optimized out>, keyuse_array=<optimized out>)at /test/11.8_dbg_san/sql/sql_select.cc:6343
|
#16 0x000055f8958c41c9 in JOIN::optimize_inner (this=0x52d0003c1e10)at /test/11.8_dbg_san/sql/sql_select.cc:2711
|
#17 0x000055f8958b4493 in JOIN::optimize (this=<optimized out>)at /test/11.8_dbg_san/sql/sql_select.cc:1994
|
#18 0x000055f895895de9 in mysql_select (thd=0x52b000165218, tables=tables@entry=0x52d0003c0b58, fields=<optimized out>, conds=<optimized out>, og_num=og_num@entry=1, order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, select_options=<optimized out>, result=0x52d0003c1de0, unit=0x52b000169540, select_lex=0x52d0003c04e0)at /test/11.8_dbg_san/sql/sql_select.cc:5361
|
#19 0x000055f895895103 in handle_select (thd=thd@entry=0x52b000165218, lex=lex@entry=0x52b000169460, result=result@entry=0x52d0003c1de0, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/11.8_dbg_san/sql/sql_select.cc:633
|
#20 0x000055f89576a108 in execute_sqlcom_select (thd=0x52b000165218, all_tables=<optimized out>) at /test/11.8_dbg_san/sql/sql_parse.cc:6191
|
#21 0x000055f895755e06 in mysql_execute_command (thd=0x52b000165218, is_called_from_prepared_stmt=<optimized out>)at /test/11.8_dbg_san/sql/sql_parse.cc:3979
|
#22 0x000055f895725629 in mysql_parse (thd=thd@entry=0x52b000165218, rawbuf=rawbuf@entry=0x52d0003c0438 "SELECT * FROM t ORDER BY c", length=<optimized out>, parser_state=parser_state@entry=0x14a7a03458a0)at /test/11.8_dbg_san/sql/sql_parse.cc:7915
|
#23 0x000055f8957196ec in dispatch_command (command=<optimized out>, thd=0x52b000165218, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/11.8_dbg_san/sql/sql_parse.cc:1902
|
#24 0x000055f89572804e in do_command (thd=thd@entry=0x52b000165218, blocking=true) at /test/11.8_dbg_san/sql/sql_parse.cc:1415
|
#25 0x000055f895df0cfd in do_handle_one_connection (connect=<optimized out>, connect@entry=0x508000002fb8, put_in_cache=true)at /test/11.8_dbg_san/sql/sql_connect.cc:1415
|
#26 0x000055f895df05b8 in handle_one_connection (arg=0x508000002fb8)at /test/11.8_dbg_san/sql/sql_connect.cc:1327
|
#27 0x000055f89511cd9d in asan_thread_start(void*) ()
|
#28 0x000014a7d149ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
|
#29 0x000014a7d1529c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
|
Setup:
Compiled with a recent version of Clang (I used Clang 18.1.3) with LLVM 18. Ubuntu instructions:
|
# Note: It is strongly recommended to uninstall all old Clang & LLVM packages (ref dpkg --list | grep -iE 'clang|llvm' and use apt purge and dpkg --purge to remove the packages), before following these steps
|
# Note: llvm-17-linker-tools installs /usr/lib/llvm-17/lib/LLVMgold.so, which is needed for compilation, and LLVMgold.so is no longer included in LLVM 18
|
sudo apt install clang llvm-18 llvm-18-linker-tools llvm-18-runtime llvm-18-tools llvm-18-dev libstdc++-14-dev llvm-dev llvm-17-linker-tools
|
sudo ln -s /usr/lib/llvm-17/lib/LLVMgold.so /usr/lib/llvm-18/lib/LLVMgold.so
|
Compiled with: "-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C{,XX}_FLAGS='-march=native -mtune=native'" and:
|
-DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON -DWITH_UBSAN=ON -DWSREP_LIB_WITH_ASAN=ON
|
Set before execution:
|
export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1 # And you may also want to supress UBSAN startup issues using 'suppressions=UBSAN.filter' in UBSAN_OPTIONS. For an example of UBSAN.filter, which includes current startup issues see: https://github.com/mariadb-corporation/mariadb-qa/blob/master/UBSAN.filter
|
Bug confirmed present in:
MariaDB: 11.4.6 (dbg), 11.8.1 (dbg), 12.0.0 (dbg)
Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.5.29 (dbg), 10.5.29 (opt), 10.6.22 (dbg), 10.6.22 (opt), 10.11.12 (dbg), 10.11.12 (opt), 11.4.6 (opt), 11.8.1 (opt), 12.0.0 (opt)
Note that a Clang UBASAN build is required to produce the bug. It does not reproduce on a standard build
Attachments
Issue Links
- relates to
-
MDEV-35072 Assertion with optimizer_join_limit_pref_ratio and 1-table select
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue relates to |
Priority | Critical [ 2 ] | Major [ 3 ] |