[MDEV-32245] Test from subselect.test fails with statement memory protection Created: 2023-09-25  Updated: 2023-09-26  Resolved: 2023-09-26

Status: Closed
Project: MariaDB Server
Component/s: Prepared Statements
Affects Version/s: 10.4, 10.5, 10.6, 10.11, 11.0
Fix Version/s: 10.4.32, 10.5.23, 10.6.16, 10.10.7, 10.11.6, 11.0.4, 11.1.3

Type: Bug Priority: Critical
Reporter: Igor Babaev Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: None


 Description   

The following test case from subselect4.test fails if the server is built with -DWITH_PROTECT_STATEMENT_MEMROOT:BOOL=ON

CREATE TABLE t1 ( f1 int) ;
INSERT INTO t1 VALUES (2),(3);
CREATE TABLE t2 (f2 int) ;
INSERT INTO t2 VALUES (2),(3);
PREPARE st1 FROM '
SELECT * FROM t2
WHERE f2 <= SOME ( SELECT f1 FROM t1 );
';
EXECUTE st1;
EXECUTE st1;

The test case fails with the assertion abort that points to re-allocation of ref_pointer_array in the function setup_ref_array() that happens at the second execution of the prepared statement.
This does not cause any leak of the statement memory because this reallocation may happen only once. Yet it would be better if such reallocation is avoided in order not to cause aborts with -DWITH_PROTECT_STATEMENT_MEMROOT:BOOL=ON



 Comments   
Comment by Igor Babaev [ 2023-09-26 ]

@sanja, please review (see also bb-10.4-igor)

Comment by Oleksandr Byelkin [ 2023-09-26 ]

OK to push

Comment by Igor Babaev [ 2023-09-26 ]

A fix for this bug was pushed into 10.4.

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