[MDEV-29624] Memory leak on pushdown of a merged derived table Created: 2022-09-24 Updated: 2022-11-07 Resolved: 2022-11-01 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.11.0 |
| Fix Version/s: | 10.11.1, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.7, 10.9.5, 10.10.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Oleg Smirnov | Assignee: | Oleg Smirnov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Test case below to reproduce the bug using FederatedX engine. On the first server (remote, runs on 127.0.0.1 port 3310):
On the second server (local):
|
| Comments |
| Comment by Oleg Smirnov [ 2022-09-25 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
The leak most probably happens due to duplicate allocation of derived->pushdown_derived. This is a piece of code from mysql_derived_optimize() where the allocation is being made:
Call stack of the first call of mysql_derived_optimize():
And the second one:
| |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleg Smirnov [ 2022-10-02 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
serg, can you please review the branch bb-10.11- | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-10-16 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
It'd be better if psergei reviews it. Still, 1) there was no test case there and 2) is it 10.11 bug or should it be fixed in an earlier version? | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleg Smirnov [ 2022-10-19 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
1) The test case is already present in federated.federatedx_create_handlers.test, lines 95-97:
2) This bug is revealed only after another bug-fix which was committed into preview-10.11-mdev-25080-union-pushdown branch:
I don't think we need to backport that memory leak fix unless we are planning to backport this one. | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleg Smirnov [ 2022-10-19 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Most probably I am wrong with statement 2) from my previous comment. We just don't have test cases which reveal the bug. This commit backported to 10.4 fixes both this issue and
| |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2022-10-23 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Review input: https://lists.launchpad.net/maria-developers/msg13251.html | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleg Smirnov [ 2022-11-01 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Pushed to 10.4. |