Bug #119281 The crash occured
Submitted: 31 Oct 14:10 Modified: 1 Nov 9:06
Reporter: Nadendla Teja Email Updates:
Status: Need Feedback Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:mysql:8.0.41 OS:Any
Assigned to: CPU Architecture:Any

[31 Oct 14:10] Nadendla Teja
Description:
My program runs the query WITH cte_sales_equipment AS (      SELECT        tmp_projectmaterialen.id,       (        tmp_saleitems.basisaantal        -- all known mutations, that took place AFTER Project `planvan`, but BEFORE `planvan` of this planning equipment        + SUM(IFNULL(tmp_momenten_sales.num_mutatie_project,0))        + SUM(IFNULL(tmp_momenten_sales.num_mutatie_no_project,0))       ) AS aantal,       tmp_projectmaterialen.materiaal,       tmp_projectmaterialen.planvan,       -- quantity, that is still to leave warehouse, according to known planning       SUM(IFNULL(tmp_momenten_sales.num_gepland, 0)) AS planned_qty      FROM        tmp_projectmaterialen      JOIN       tmp_saleitems ON         tmp_saleitems.materiaal = tmp_projectmaterialen.materiaal        AND         tmp_saleitems.asset_location = tmp_projectmaterialen.asset_location      JOIN       materialen ON tmp_saleitems.materiaal = materialen.id      LEFT JOIN       tmp_momenten_sales ON         tmp_projectmaterialen.materiaal = tmp_momenten_sales.materiaal     

I expected MySQL to return a data based on the query instead the crash happened on the server
  
1: 2025-10-24T22:36:51Z UTC - mysqld got signal 11 ;
2: Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
3: Thread pointer: 0x4004354f5000
4: Attempting backtrace. You can use the following information to find out
5: where mysqld died. If you see no messages after this, something went
6: terribly wrong...
7: stack_bottom = 400040542cd0 thread_stack 0x40000
8: /rdsdbbin/mysql/bin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x2c) [0x13829ec]
9: /rdsdbbin/mysql/bin/mysqld(print_fatal_signal(int)+0x25c) [0xb3e03c]
10: /rdsdbbin/mysql/bin/mysqld(handle_fatal_signal+0x90) [0xb3e2f0]
11: linux-vdso.so.1(__kernel_rt_sigreturn+0) [0x400022006850]
12: /lib64/libc.so.6(memcmp+0x8) [0x400022264188]
13: /rdsdbbin/mysql/bin/mysqld() [0x183ef98]
14: /rdsdbbin/mysql/bin/mysqld() [0x1357f04]
15: /rdsdbbin/mysql/bin/mysqld(lf_hash_search(LF_HASH*, LF_PINS*, void const*, unsigned int)+0xc8) [0x135d8c8]
16: /rdsdbbin/mysql/bin/mysqld(MDL_context::try_acquire_lock_impl(MDL_request*, MDL_ticket**)+0x1f0) [0xd8fb10]
17: /rdsdbbin/mysql/bin/mysqld(MDL_context::acquire_lock(MDL_request*, unsigned long)+0x54) [0xd90134]
18: /rdsdbbin/mysql/bin/mysqld(open_table(THD*, Table_ref*, Open_table_context*)+0x8c4) [0x9a2384]
19: /rdsdbbin/mysql/bin/mysqld(open_tables(THD*, Table_ref**, unsigned int*, unsigned int, Prelocking_strategy*)+0x3d8) [0x9a3778]
20: /rdsdbbin/mysql/bin/mysqld(open_tables_for_query(THD*, Table_ref*, unsigned int)+0x4c) [0x9a522c]
21: /rdsdbbin/mysql/bin/mysqld(Sql_cmd_dml::prepare(THD*)+0xc4) [0xa747a4]
22: /rdsdbbin/mysql/bin/mysqld(Sql_cmd_dml::execute(THD*)+0xd0) [0xa67950]
23: /rdsdbbin/mysql/bin/mysqld(mysql_execute_command(THD*, bool)+0x7c0) [0xa29c60]
24: /rdsdbbin/mysql/bin/mysqld(dispatch_sql_command(THD*, Parser_state*)+0x46c) [0xa2cdcc]
25: /rdsdbbin/mysql/bin/mysqld(dispatch_command(THD*, COM_DATA const*, enum_server_command)+0x16b8) [0xa2ea38]
26: /rdsdbbin/mysql/bin/mysqld(do_command(THD*)+0x264) [0xa2f3a4]
27: /rdsdbbin/mysql/bin/mysqld() [0xb379a4]
28: /rdsdbbin/mysql/bin/mysqld() [0x16e9ce0]
29: /lib64/libpthread.so.0(+0x7230) [0x4000220c1230]
30: /lib64/libc.so.6(+0xdb7dc) [0x4000222bc7dc]

How to repeat:
See description
[1 Nov 9:06] MySQL Verification Team
Hi

Thanks for the report.
Can you try 8.0.44, or 8.4.7 from dev.mysql.com and see if it crashes too?
Send explain plan and table structures for tables referenced:

explain WITH cte_sales_equipment AS (
 SELECT tmp_projectmaterialen.id,
 (
  tmp_saleitems.basisaantal
  + SUM(IFNULL(tmp_momenten_sales.num_mutatie_project,0))
  + SUM(IFNULL(tmp_momenten_sales.num_mutatie_no_project,0))
 ) AS aantal,
 tmp_projectmaterialen.materiaal,
 tmp_projectmaterialen.planvan,
 SUM(IFNULL(tmp_momenten_sales.num_gepland, 0)) AS planned_qty
 FROM tmp_projectmaterialen
 JOIN tmp_saleitems 
  ON tmp_saleitems.materiaal = tmp_projectmaterialen.materiaal  
  AND tmp_saleitems.asset_location = tmp_projectmaterialen.asset_location
JOIN materialen ON tmp_saleitems.materiaal = materialen.id 
LEFT JOIN tmp_momenten_sales 
  ON tmp_projectmaterialen.materiaal = tmp_momenten_sales.materiaal ;

show create table tmp_projectmaterialen \G
show create table tmp_saleitems \G
show create table materialen \G
show create table tmp_momenten_sales \G
select version();

Then we'll see if it is repeatable crash with fake data.

regards,
-- 
Shane, MySQL Senior Principal Technical Support Engineer
Oracle Corporation
http://dev.mysql.com/