[MDEV-8474] InnoDB sets per-connection data unsafely Created: 2015-07-16 Updated: 2015-07-21 Resolved: 2015-07-21 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Storage Engine - XtraDB |
| Affects Version/s: | 5.5, 10.0, 10.1 |
| Fix Version/s: | 5.5.45, 10.0.21 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergey Vojtovich | Assignee: | Jan Lindström (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
InnoDB sets THD::ha_data as following:
This is unsafe, because nothing prevents InnoDB plugin from being uninstalled while there's active transaction. This can cause crashes and any other odd behavior. It may also corrupt stack, as functions pointers are not available after dlclose. E.g. spider has similar bug and outcome was like To reproduce this it should be enough to have one thread with active InnoDB transaction, no InnoDB tables in table cache and one thread issuing UNINSTALL PLUGIN innodb. The fix is to use thd_set_ha_data() when manipulating per-connection handler data. It does appropriate plugin locking. |
| Comments |
| Comment by Jan Lindström (Inactive) [ 2015-07-21 ] | ||||||||||||||||||||||||||||||||||
|
Hi, I could not repeat with
.opt:
I see only:
| ||||||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2015-07-21 ] | ||||||||||||||||||||||||||||||||||
|
The following test causes UNINSTALL PLUGIN to wait till all transactions are completed:
It's not that bad as such, but it doesn't go inline with normal UNINSTALL PLUGIN at least. Trying to find more serious edge cases now. | ||||||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2015-07-21 ] | ||||||||||||||||||||||||||||||||||
|
The following UNINSTALL PLUGIN seem to have hung forever:
| ||||||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2015-07-21 ] | ||||||||||||||||||||||||||||||||||
|
Simpler hang, now default connection doesn't participate in any transaction:
| ||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2015-07-21 ] | ||||||||||||||||||||||||||||||||||
|
commit 7a9670218b2d1b5673432ebf4e0f028a7c963494 Analysis: At check_trx_exists function InnoDB allocates Fix: The fix is to use thd_set_ha_data() when |