[MDEV-31622] Crash on a specific query Created: 2023-07-04  Updated: 2023-07-04  Resolved: 2023-07-04

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.11.3
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Crypteo Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: crash
Environment:

Linux version 6.1.0-9-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian 6.1.27-1 (2023-05-08)

MariaDB 10.11.3-MariaDB-1


Issue Links:
Duplicate
duplicates MDEV-31403 Server crashes in st_join_table::choo... Closed

 Description   

The server crash on the following query :

 
SELECT 
	( select 1
           from (
               select project_id, spent_on from time_entries
               group by project_id, spent_on
            ) te
            where te.project_id = contract.projects_id
) o
FROM `contract`
GROUP BY `contract`.`id`

With the following database :

CREATE TABLE `contract` (
  `id` int(11) NOT NULL,
  `projects_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
 
CREATE TABLE `time_entries` (
  `id` int(11) NOT NULL,
  `project_id` int(11) NOT NULL,
  `spent_on` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
 
ALTER TABLE `contract`
  ADD PRIMARY KEY (`id`),
  ADD KEY `projects_id` (`projects_id`);
 
ALTER TABLE `time_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `project_id` (`project_id`);
 
ALTER TABLE `contract`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
 
ALTER TABLE `time_entries`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

Here the log :

Thread pointer: 0x7f03ac000c68
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x7f041818ccb8 thread_stack 0x30000
/usr/sbin/mariadbd(my_print_stacktrace+0x2e)[0x562b56c6ecfe]
/usr/sbin/mariadbd(handle_fatal_signal+0x2c3)[0x562b567dc683]
/lib/x86_64-linux-gnu/libc.so.6(+0x3bf90)[0x7f042b45af90]
/usr/sbin/mariadbd(_ZN13st_join_table21choose_best_splittingEjyPy+0x640)[0x562b56760230]
/usr/sbin/mariadbd(_Z16best_access_pathP4JOINP13st_join_tableyPK8POSITIONjbdPS3_S6_+0x169)[0x562b565ebb49]
/usr/sbin/mariadbd(+0x83b744)[0x562b565ef744]
/usr/sbin/mariadbd(+0x83fcaa)[0x562b565f3caa]
/usr/sbin/mariadbd(_Z11choose_planP4JOINy+0x318)[0x562b565f5298]
/usr/sbin/mariadbd(+0x862fef)[0x562b56616fef]
/usr/sbin/mariadbd(_ZN4JOIN14optimize_innerEv+0x1395)[0x562b5661bd95]
/usr/sbin/mariadbd(_ZN4JOIN8optimizeEv+0xaa)[0x562b5661c32a]
/usr/sbin/mariadbd(_ZN13st_select_lex31optimize_unflattened_subqueriesEb+0xe4)[0x562b565830a4]
/usr/sbin/mariadbd(_ZN4JOIN15optimize_stage2Ev+0x1707)[0x562b56619547]
/usr/sbin/mariadbd(_ZN4JOIN14optimize_innerEv+0x1492)[0x562b5661be92]
/usr/sbin/mariadbd(_ZN4JOIN8optimizeEv+0xaa)[0x562b5661c32a]
/usr/sbin/mariadbd(_Z12mysql_selectP3THDP10TABLE_LISTR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0xca)[0x562b5661c40a]
/usr/sbin/mariadbd(_Z13handle_selectP3THDP3LEXP13select_resulty+0x13f)[0x562b5661cbef]
/usr/sbin/mariadbd(+0x7e8860)[0x562b5659c860]
/usr/sbin/mariadbd(_Z21mysql_execute_commandP3THDb+0x3dc5)[0x562b565a9125]
/usr/sbin/mariadbd(_Z11mysql_parseP3THDPcjP12Parser_state+0x1b5)[0x562b565aa5e5]
/usr/sbin/mariadbd(_Z16dispatch_command19enum_server_commandP3THDPcjb+0x1005)[0x562b565ac515]
/usr/sbin/mariadbd(_Z10do_commandP3THDb+0x137)[0x562b565adb27]
/usr/sbin/mariadbd(_Z24do_handle_one_connectionP7CONNECTb+0x3b7)[0x562b566be7b7]
/usr/sbin/mariadbd(handle_one_connection+0x5d)[0x562b566beb4d]
/usr/sbin/mariadbd(+0xc2d630)[0x562b569e1630]
/lib/x86_64-linux-gnu/libc.so.6(+0x88fd4)[0x7f042b4a7fd4]
/lib/x86_64-linux-gnu/libc.so.6(+0x1095bc)[0x7f042b5285bc]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f03ac010fc0): SELECT
        ( select 1
           from (
               select project_id, spent_on from time_entries
               group by project_id, spent_on
            ) te
            where te.project_id = contract.projects_id
) o
FROM `contract`
GROUP BY `contract`.`id` LIMIT 0, 25



 Comments   
Comment by Daniel Black [ 2023-07-04 ]

This is a duplicate of MDEV-31402- and has been fixed in 10.11.4

release notes

Comment by Daniel Black [ 2023-07-04 ]

tested on MariaDB 10.11.5-MariaDB-1:10.11.5+maria~ubu2204 source revision 71a1a28a49075f0dcf280d5653d13fca22de0d7a without crash.

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