[MDEV-11630] Call mutex_free() before freeing the mutex list Created: 2016-12-22 Updated: 2016-12-23 Due: 2016-12-22 Resolved: 2016-12-22 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.2.3 |
| Fix Version/s: | 10.1.21, 10.2.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | valgrind | ||
| Sprint: | 10.2.4-5 |
| Description |
|
The call to srv_latch_meta_destroy() was disabled, because it was dereferencing some freed memory, because some calls to mutex_free() were omitted. Do call the function on shutdown, and ensure that all mutex_create() is paired with mutex_free(). |
| Comments |
| Comment by Jan Lindström (Inactive) [ 2016-12-22 ] |
|
ok to push, consider also 10.1 |
| Comment by Marko Mäkelä [ 2016-12-22 ] |
|
In 10.1 the code is different. sync_latch_meta_destroy() was introduced in the refactoring in MySQL 5.7. In 10.1, it looks like forgetting the mutex_free() will leave garbage in mutex_list. While this might not be detected by memory leak tools if the mutex_list is freed at shutdown, it still is a problem to keep a lot of garbage in that list, especially if those garbage pointers can sometimes be dereferenced. So, I will try backporting the fix to 10.1 as well. |
| Comment by Marko Mäkelä [ 2016-12-22 ] |
|
10.1 seems to be better in this respect. fil_space_crypt_cleanup() forgot to call mutex_free() for two mutexes and fil_crypt_threads_cleanup() for one, but those are called during shutdown anyway. innobase_shutdown_for_mysql() should possibly shut down the encryption threads even when innodb_read_only_mode. I am testing those changes. |
| Comment by Marko Mäkelä [ 2016-12-22 ] |
|
I made a simpler patch for 10.1. Also there we were missing some mutex_free() before sync_close() which does the equivalent of sync_latch_meta_destroy(). |
| Comment by Jan Lindström (Inactive) [ 2016-12-22 ] |
|
ok to push also part 2. |