[MDEV-10496] Connect Engine: CREATE TABLE memory leak Created: 2016-08-04 Updated: 2017-06-27 Resolved: 2016-08-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.0, 10.1 |
| Fix Version/s: | 10.1.18, 10.0.28 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Sergey Antonyuk | Assignee: | Olivier Bertrand |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
3.2.0-4-amd64 #1 SMP Debian 3.2.35-2 x86_64 GNU/Linux |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
Scenario: Bash console (it's mandatory to execute from the bash): 2) mysql -h 127.0.0.1 --port=3306 -u user -ppassword db -e 'CREATE TABLE c1 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='\''information_schema'\'' OPTION_LIST='\''host=127.0.0.1,port=33235,user=user,password=password'\'' `tabname`='\''tables'\''' This scenario leads to spending an additional 500 MB of virtual memory (don't know exactly about the physical memory) for each repetition. This memory is not released until you restart the mysql process. Remote database name and a table - can be any. |
| Comments |
| Comment by Elena Stepanova [ 2016-08-04 ] | ||
|
I'm not getting any memory growth with the described scenario, neither on the current tree nor on 10.1.12 build. Does the server on port 33235 exist? Or more generally, is the table creation in the scenario successful? Please also attach your cnf file(s). Thanks. | ||
| Comment by Sergey Antonyuk [ 2016-08-05 ] | ||
|
Yes, the server exists and the table created. Port 33235 is the ssh tunnel to remote MariaDB 10.1.12 but it doesn't matter because the following loopback also leads to the problem: The table ENGINES have 9 rows and the memory leaks the same way. The problem doesn't reproduce if I execute the commands from the open mysql console. It's mandatory to use shell to reproduce the problem. | ||
| Comment by Sergey Antonyuk [ 2016-08-05 ] | ||
|
Memory leak is directly correlated with "connect_work_size" variable. It equals 1000M in my case. | ||
| Comment by Elena Stepanova [ 2016-08-07 ] | ||
|
Thanks, I can reproduce it now. | ||
| Comment by Egor Karavaev (Inactive) [ 2016-08-15 ] | ||
|
Hi, I've looked into the problem a bit and I think I've found the leak in the connect_assisted_discovery function, ha_connect.cc : 5176
Here PCONNECT is a pointer to an user_connect object and GetPlug is a wrapper what calls the GetUser function and assigns the result to its second argument. GetUser function in turn allocates a new user_connect object (or increments a refcounter of an existing one). Since in the end the only owner of the newly created user_connect object is the xp variable, the object have to be explicitly freed (in a manner of the ha_connect::~ha_connect function) via the variable before the end of the function, which is never done. Unfortunately I can't produce a proper patch right now, but I hope this will help to fix the bug. | ||
| Comment by Olivier Bertrand [ 2016-08-30 ] | ||
|
Thanks for pointing out this and show where the problem was. | ||
| Comment by Sergey Antonyuk [ 2017-06-27 ] | ||
|
I've checked the fix for version 10.1.24.
As you can see this is the same scenario continued by the third step. | ||
| Comment by Elena Stepanova [ 2017-06-27 ] | ||
|
Sergey.Antonyuk, thank you, would you mind creating a new bug report? A comment in a closed one is likely to be missed, and we normally don't re-open closed ones after the fix version was released, because it confuses the release history. | ||
| Comment by Sergey Antonyuk [ 2017-06-27 ] | ||
|
Ok, it's clear now. I've created new bug report |