[MDEV-28251] too small max_statement_time is ignored Created: 2022-04-07  Updated: 2022-07-19  Resolved: 2022-07-19

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

Type: Bug Priority: Major
Reporter: Daniel Black Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-27955 main.func_json_notembedded test fails... Closed
duplicates MDEV-28714 JSON functions still don't respect KI... Open

 Description   

modified func_json_notembedded test

$ mysql-test/mtr main.func_json_notembedded
Logging: /home/dan/repos/mariadb-server-10.6/mysql-test/mariadb-test-run.pl  main.func_json_notembedded
VS config: 
vardir: /home/dan/repos/build-mariadb-server-10.6/mysql-test/var
Checking leftover processes...
Removing old var directory...
Creating var directory '/home/dan/repos/build-mariadb-server-10.6/mysql-test/var'...
Checking supported features...
MariaDB Version 10.6.8-MariaDB
 - SSL connections supported
 - binaries built with wsrep patch
Collecting tests...
Installing system database...
 
==============================================================================
 
TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------
 
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
main.func_json_notembedded               [ fail ]
        Test ended at 2022-04-07 13:52:38
 
CURRENT_TEST: main.func_json_notembedded
mysqltest: At line 38: query 'select json_merge_patch(@obj, @obj)' failed with wrong errno <Unknown> (2013): 'Lost connection to server during query', instead of ER_STATEMENT_TIMEOUT (1969)...
 
The result from queries just before the failure was:
< snip >
select sleep(t);
execute immediate 'kill connection ?' using c;
end|
connection default;
set @timeout= 20;
call kill_soon(@timeout, THE_OTHER_CONNECTION);;
connection u;
#
# MDEV-24909 JSON functions don't respect KILL QUERY / max_statement_time limit
#
set group_concat_max_len= 4294967295;
set @obj=concat_ws('','{', repeat('"a":"b",', 125000), '"c":"d"}');
set @arr=concat_ws('','[', repeat('1234567,', 125000), '2345678]');
select length(@obj), length(@arr);
length(@obj)	length(@arr)
1000009	1000009
set max_statement_time=0.0001;
set max_statement_time=0.0000001;
select json_merge_patch(@obj, @obj);
 
The servers were restarted 0 times
Spent 0.000 of 36 seconds executing testcases

The 36 second case was only limited by the 20 second kill from the other thread.

source include/have_profiling.inc;
source include/not_embedded.inc;
 
set global max_allowed_packet=1073741824;
connect u,localhost,root;
 
delimiter |;
 
create procedure kill_soon(IN t INT, IN C INT)
begin
  select sleep(t);
  execute immediate 'kill connection ?' using c;
end|
 
delimiter ;|
 
--let $con=`SELECT CONNECTION_ID()`
 
connection default;
set @timeout= 20;
--replace_result $con THE_OTHER_CONNECTION
--send_eval call kill_soon(@timeout, $con);
 
connection u;
 
--echo #
--echo # MDEV-24909 JSON functions don't respect KILL QUERY / max_statement_time limit
--echo #
set group_concat_max_len= 4294967295;
 
set @obj=concat_ws('','{', repeat('"a":"b",', 125000), '"c":"d"}');
set @arr=concat_ws('','[', repeat('1234567,', 125000), '2345678]');
select length(@obj), length(@arr);
 
set max_statement_time=0.0001;
set max_statement_time=0.0000001;
--error ER_STATEMENT_TIMEOUT
select json_merge_patch(@obj, @obj);
enable_abort_on_error;
disconnect u;
connection default;
--replace_result $con THE_OTHER_CONNECTION
--error ER_NO_SUCH_THREAD
reap;
 
drop procedure kill_soon;
set global max_allowed_packet=default;


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