[MDEV-26781] InnoDB hangs on SPATIAL INDEX when using SUX_LOCK_GENERIC Created: 2021-10-07 Updated: 2022-04-06 Resolved: 2022-04-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | GIS, Storage Engine - InnoDB |
| Affects Version/s: | 10.6, 10.7 |
| Fix Version/s: | 10.6.8, 10.7.4, 10.8.3, 10.9.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | hang, regression-10.6 | ||
| Environment: |
Any OS for which futex support has not been implemented (not Linux, OpenBSD, Microsoft Windows) |
||
| Issue Links: |
|
||||||||
| Description |
|
The test innodb_gis.rtree_purge would easily hang when using the fallback SUX_LOCK_GENERIC implementation, which is the only option for operating systems for which we lack a futex-like interface:
This appears to be a deadlock involving DML and purge:
At the same time, a purge task is attempting to acquire a shared latch on the page:
On the futex-based implementation this works fine. That is, MariaDB running on Linux, OpenBSD, and Microsoft Windows should not be affected by this. An easy fix could be to compose the ssux_lock out of 2 std::atomic fields (like in |
| Comments |
| Comment by Marko Mäkelä [ 2022-04-06 ] |
|
The buggy implementation would occasionally cause hangs, not only SPATIAL INDEX tests but also in other functionality. On FreeBSD before This was fixed by implementing a minimal layer to emulate futex:
Compared to the old buggy implementation, sizeof(ssux_lock) and sizeof(sux_lock) will increase by 4 bytes. In the buggy implementation, there was only one 32-bit lock word, while now there are two: writer and readers. |