[MDEV-20746] Crash on query with EXISTS Created: 2019-10-04  Updated: 2019-10-06  Resolved: 2019-10-06

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

Type: Bug Priority: Major
Reporter: Thomas Plant Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Environment:

CentOS Linux release 7.7.1908 (Core)
MariaDB is running with stock configuration from RPM packages, out of MariaDB repository.


Attachments: Zip Archive Desktop.zip    
Issue Links:
Duplicate
is duplicated by MDEV-20252 Specific SQL query consistently crash... Closed

 Description   

When we execute the following query the server crashes:

SELECT * FROM `users` WHERE ( `role` = 1 OR `role` = 10 ) AND EXISTS ( SELECT * FROM `email_templates` INNER JOIN `users_email` ON `email_templates`.`id` = `users_email`.`email_template_id` WHERE `users`.`id` = `users_email`.`user_id` AND `email_template_id` = 12 ) AND `users`.`deleted_at` IS NULL;

If executed with the value of for example 11 (or any other value) in 'email_template_id' the query works.

Here the log in MariaDB error file:

Thread pointer: 0x55d12dc0ed28
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 = 0x7ff2fd21dcf0 thread_stack 0x49000
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x55d12b70483e]
/usr/sbin/mysqld(handle_fatal_signal+0x30f)[0x55d12b19ae0f]
sigaction.c:0(__restore_rt)[0x7ff3153325f0]
/usr/sbin/mysqld(handler_index_cond_check+0xbf)[0x55d12b1a56af]
/usr/sbin/mysqld(+0x59ee80)[0x55d12ae94e80]
/usr/sbin/mysqld(+0xb340cd)[0x55d12b42a0cd]
/usr/sbin/mysqld(+0xa52c87)[0x55d12b348c87]
/usr/sbin/mysqld(+0xa52edf)[0x55d12b348edf]
/usr/sbin/mysqld(_ZN7handler11ha_rnd_nextEPh+0x10f)[0x55d12b19f8ff]
/usr/sbin/mysqld(_Z13rr_sequentialP11READ_RECORD+0x1c)[0x55d12b2cde9c]
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x1a9)[0x55d12afc7dd9]
/usr/sbin/mysqld(_ZN4JOIN10exec_innerEv+0xb9c)[0x55d12afea4cc]
/usr/sbin/mysqld(_ZN4JOIN4execEv+0x33)[0x55d12afea723]
/usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x186)[0x55d12afe8a26]
 
/usr/sbin/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x1d7)[0x55d12afe9597]
/usr/sbin/mysqld(+0x58dd2a)[0x55d12ae83d2a]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x4591)[0x55d12af90641]
/usr/sbin/mysqld(_ZN18Prepared_statement7executeEP6Stringb+0x4b6)[0x55d12afa8d06]
/usr/sbin/mysqld(_ZN18Prepared_statement12execute_loopEP6StringbPhS2_+0x92)[0x55d12afa8ec2]
/usr/sbin/mysqld(+0x6b3827)[0x55d12afa9827]
/usr/sbin/mysqld(_Z19mysqld_stmt_executeP3THDPcj+0x27)[0x55d12afa98b7]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x1625)[0x55d12af97d85]
/usr/sbin/mysqld(_Z10do_commandP3THD+0x11c)[0x55d12af99aac]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x1fa)[0x55d12b07718a]
/usr/sbin/mysqld(handle_one_connection+0x3d)[0x55d12b07726d]
pthread_create.c:0(start_thread)[0x7ff31532ae65]
/lib64/libc.so.6(clone+0x6d)[0x7ff3136cb88d]

I attach zip file with Table and Index description and two files with 'EXPLAIN EXTENDED', first where the query crashes and the second with a working query.



 Comments   
Comment by Alice Sherepa [ 2019-10-04 ]

Please, try setting optimizer_switch='rowid_filter=off' as a temporary workaround.
I did not reproduce the issue, but it seems to be the same bug as MDEV-20252.

Comment by Thomas Plant [ 2019-10-04 ]

Yes, setting optimizer_switch='rowid_filter=off' resolves the issue on our server.

Thanks,
Thomas

Comment by Elena Stepanova [ 2019-10-06 ]

Let's then continue tracking it in MDEV-20252.

Generated at Thu Feb 08 09:01:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.