[MDEV-17904] Server crashes in fts_is_sync_needed upon timed out FLUSH TABLES after unsuccessful ADD FOREIGN KEY Created: 2018-12-05 Updated: 2018-12-07 Resolved: 2018-12-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Full-text Search, Storage Engine - InnoDB |
| Affects Version/s: | 10.2 |
| Fix Version/s: | 10.4.1, 10.1.38, 10.0.38, 10.2.20, 10.3.12 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | affects-tests | ||
| Description |
|
Note: I can't say whether the problem is new, because until recently the test case failed with Run the test case with --repeat=N. It usually fails for me on the 2nd attempt. Possibly when the reason is known, it can be converted into a deterministic test case. It would also be good to get rid of the long lock_wait_timeout.
|
| Comments |
| Comment by Elena Stepanova [ 2018-12-06 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
The following assertion failure has also occurred in the tests:
I suppose it's a variation of the same problem. I don't have a separate test case for the assertion failure. | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-12-07 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Both variations should be equivalent. The cause is that slot->table is pointing to freed memory. AddressSanitizer confirms it:
| ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-12-07 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
The problem is that a function was called prematurely, before the table was successfully created. With the following change, I cannot repeat this particular crash:
But, this code feels fragile. It seems that normal DROP TABLE and ALTER TABLE are covered by the following:
In the submitted test case, the table was being rebuilt due to ADD FOREIGN KEY, but an error was detected before the indexes were added to the being-created new table stub. It looks like this bug is also possible in MariaDB 10.0 and 10.1: fts_optimize_add_table() is being invoked already in create_table_def(), before the table has been successfully created. The fix would be a little different, because create_table_info_t was introduced in 10.2 only. |