[MDEV-22859] Possible hang in InnoDB rw_lock_lock_word_decr() Created: 2020-06-10 Updated: 2020-06-10 Resolved: 2020-06-10 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.2.3, 10.3.0, 10.4.0, 10.5.0 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Not a Bug | Votes: | 1 |
| Labels: | hang, race | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
In
Because we sample the local_lock_word only once at the start of the loop, it is possible that the following happens during rw_lock_s_lock():
|
| Comments |
| Comment by Marko Mäkelä [ 2020-06-10 ] | |||||||||
|
Sorry, I missed the fact that my_atomic_caslint() is reloading the local_lock_word. On GCC-compatible compilers, the macro maps to the following code:
The "+S" means that the parameter a is both read and written by the assembler snippet via the esi (or rsi) register. The + feels unnecessary to me, because we are changing the data that esi (or rsi) points to, not esi itself. The "+A" means that the register pair eax:edx would be both read and written on IA-32. So, it says that cmp will be assigned to. The cmpxchg8b instruction is documented to operate on eax:edx and ecx:ebx and its operand. So, everything looks correct after all. The previous primitive os_compare_and_swap_lint() failed to return the value that was read. |