[MDEV-27463] Prepared statement needs to be re-prepared Created: 2022-01-10  Updated: 2022-01-25

Status: Open
Project: MariaDB Server
Component/s: Data Definition - Procedure
Affects Version/s: 10.3.22
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Mike Ilin Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None

Attachments: Text File fragment.cpp     File fragment.sql    
Issue Links:
Relates
relates to MDEV-17124 mariadb 10.1.34, views and prepared s... Closed

 Description   

Stored procedures contain statement like:
SET @vartmp = ...;
PREPARE _stmt FROM @vartmp;
EXECUTE _stmt;

Sometimes the execution fails with error: mysql_errno:1615, mysql_warning_count:0, mysql_sqlstate:'HY000', mysql_error:'Prepared statement needs to be re-prepared'

No idea how to reproduce stably this issue. It happens randomly on various objects from time to time. No DDL operations during the execution.

MariaDB configuration:
table_open_cache = 60000
table_definition_cache = 60000

I'm happy to provide any information required to solve the problem.



 Comments   
Comment by Mike Ilin [ 2022-01-13 ]

Seems like MariaDB has a sort of leak, because the error may disappear for some time after restarting mariadb service.

Comment by Mike Ilin [ 2022-01-25 ]

I could reproduce the issue doing the following steps:

1. Run statements from the first part of the attached script fragment.sql
2. Run code from the file fragment.cpp many thousands of times. I run the c++ code multiple times (thousands of times) in series (i.e. each run in a separate process)
3. Execute statement : CALL failing_procedure();

After that it is not possible to call the `failing_procedure`. It fails with message: `Prepared statement needs to be re-prepared.`

After restarting of MariaDB service the error disappears for some time.

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