[MDEV-16940] Server crashes in unsafe_key_update upon attempt to update view through 2nd execution of SP Created: 2018-08-11 Updated: 2021-05-02 Resolved: 2021-01-20 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Stored routines, Views |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.2.37, 10.3.28, 10.4.18, 10.5.9 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | affects-tests | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
All of 5.5-10.3 crash in the same fashion, both debug and non-debug. |
| Comments |
| Comment by Hartmut Holzgraefe [ 2020-06-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
A customer has now run into crashes that look very similar, although not 100% the same. First crash was:
So it happened on a multi table UPDATE inside a stored procedure, but already crashed on mysql_multi_update_prepare with unsafe_key_update not seen in this backtrace Whether one of the two tables involved in the UPDATE was actually a VIEW is not known. The second crash indeed happened in unsafe_key_update inside a stored procedure call, but in this case it seems to have been a direct call
There was a third crash shortly after, but that did not even have a backtrace ... All three crashes happened with 10.1.34. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-01-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It is not problem for prepared statmemns, because they do not allow to prepare statement with such error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-01-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The real problem is that the VIEW got in leaf tables list because "full_list" is not requested by Multiupdate_prelocking_strategy::handle_end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-01-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
the above change was done by d37465a9cc458ab215105de22875ce0a64c0efc2 And I do not understand the patch (why it changed full_list to FALSE, and how derived supposed to be processed if TABLE shoud be present for more checks in leas check: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2021-01-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Here's my analysis of the bug. The first call of SP sp():
has been executed this list contains t1,t2. The second call of SP sp()
The following code is executed in setup_tables()
This code put into select_lex->leaf_tables only v, as the 'then' branch of the conditional statement is chosen.
does nothing and select_lex->leaf_tables still contains only v when we come to the call of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2021-01-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
OK to push! Thank you for investigating and fixing it! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2021-01-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
A fix for this bug was pushed into 10.2 |