Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
11.2(EOL), 11.3(EOL), 11.4, 11.5(EOL), 11.6(EOL), 11.7
-
None
Description
Consider the following use case:
CREATE TABLE t1 (a INT); |
CREATE PROCEDURE p1() |
SELECT * FROM t1; |
CALL p1();
|
DROP TABLE t1; |
CREATE TABLE t1 (a INT); |
CALL p1(); # <<=== Second call of the stored procedure p1 could lead to memory leaks |
Memory leaks is caused by re-parsing of the failed statement (SELECT * FROM t1 in the mentioned case). On re-parsing, a memory is allocated on sp_head memory root that was already marked as read-only after first success execution of the stored procedure p1.
This issue is fixed by adding a new memory root to SP-instruction on starting re-parsing process and forwarding further memory allocations that will taken place on re-parsing of a SP instruction's statement to this new memory root. Please draw attention, that a memory for the new mem_root is allocated on sp_head's memory root and pointer to the new memory root is stored inside the SP-instruction class sp_lex_instr.
Attachments
Issue Links
- is part of
-
MDEV-14959 Control over memory allocated for SP/PS
- Closed