[MDEV-6212] TokuDB: memory leak in external_lock Created: 2014-05-06 Updated: 2022-09-08 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.5.37, 10.0.10 |
| Fix Version/s: | 5.5 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Sergey Vojtovich | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | tokudb, upstream | ||
| Issue Links: |
|
||||||||
| Description |
|
A split from
|
| Comments |
| Comment by Rich Prohaska [ 2014-05-06 ] | |||||||||||||||||||||||||||||||
|
client runs the insert statement. tokudb::external lock sets thd->ha_data[tokudb_hton->slot] = malloced tokudb_trx_data. client uninstalls the tokudb plugin. the tokudb_hton->close_connection function does not get called, so the tokudb trx data does not get freed. valgrind proclaims a leak. IMO, the uninstall of the plugin should call the close_connection function for all THD's that have used the plugin. this is not happening. | |||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2014-05-06 ] | |||||||||||||||||||||||||||||||
|
Hi Rich, there is an API which should be used to set/get ha_data, which TokuDB doesn't seem to follow. For details please see the following revision:
| |||||||||||||||||||||||||||||||
| Comment by Rich Prohaska [ 2014-05-06 ] | |||||||||||||||||||||||||||||||
|
after using thd_set/ha_data and thd_ha_data, the memory leak still exists. in addition, this is now in the error log: 140506 14:48:10 [ERROR] Plugin 'TokuDB' has ref_count=1 after shutdown. so, there is another problem. what event other than close_connection would get rid of the plugin reference? | |||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2014-05-06 ] | |||||||||||||||||||||||||||||||
|
Could you share your patch? I can't remember at glance extra requirements, but this error in the log looks like a sign that we're on a right way. | |||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2014-05-07 ] | |||||||||||||||||||||||||||||||
|
Rich, fwics TokuDB doesn't reset ha_data thus this error and memory leak. It should call thd_set_ha_data(thd, hton, NULL) whenever ha_data is not needed anymore. I suppose in case of TokuDB it is transaction commit/rollback/cancel/abort/whatever. |