[MDEV-21098] Crash in rec_get_offsets_func() due to invalid rec_get_status() Created: 2019-11-20 Updated: 2023-04-14 Resolved: 2022-08-01 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Subquery, Storage Engine - InnoDB |
| Affects Version/s: | 10.3.11 |
| Fix Version/s: | 10.6.9, 10.7.5, 10.8.4, 10.9.2, 10.10.1 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Nigel Gomm | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
linux |
||
| Attachments: |
|
||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Description |
|
where to begin..... Over the last 24 hours i've had 3 (out of 5 total) mariadb production servers crash with similar errors (see attachment). Each server has about 30 customer databases (identical structure) that customers connect to from an indentical win32 desktop using ODBC. INNODB tables. Not aware of any changes to the servers or the databases or the win32.exe. On each server there has been, since yesterday, one database where if i run a couple of specific but seemingly innocuous queries the server crashes and restarts. The error mentions an index.... so in each of the queries i (eventually) removed the indexes used by a subquery. and hey presto no crash. slow but no crash. I must emphasise that i only removed the indexes from the one database on each server that was mentioned in the crash report. The other databases with the same structure on the same servers continue to work just fine with the same queries and the same indexes . And the database that are causing a crash have been same structure running same queries for months and months. the databases causing the error are no larger than any of the others (a few thousand records in the deal and invoices tables). i removed the indexes on invoices,dealid invoices.who invoices.term invoices.invoice deal.dealid .dealid and .invoice and .term are int 11; .who is varchar 10 the other query that causes a crash is an update and uses invoice.invoice in a subquery again, to emphasise, this query has been run a thousand times a day on 200 or more databases for more than a year with no problem... until yesterday on 3 databases |
| Comments |
| Comment by Nigel Gomm [ 2019-11-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
one server also giving this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nigel Gomm [ 2019-11-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
today (but not yesterday) check table is reporting index corruptions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2019-11-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From the log:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nigel Gomm [ 2019-12-04 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
problem went away when i exported each table, dropped them and imported back in. So some sort of data corruption that corrupted the indexes? Odd that the same 3 tables on 3 different databases (out of 300 or so identically structured databases) got the same error on the same day. oh well... customers are now happy so i will stop worrying about it unless it reoccurs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-02-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The assertion failed in rec_get_offsets_func(), because rec_get_status() returned an invalid bit combination on a record header. This report is basically duplicating For a while, I was thinking whether | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-06-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-06-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It is not easy to fix this. It may be necessary to implement record header validation in specific places that have are (since | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-06-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
A possible fix of this could be to introduce some record header validation to the following functions (and make the functions return some special value such as nullptr on corruption, and adjust their callers):
These measures should guarantee that rec_get_offsets_func() is never invoked on a corrupted record header. For added safety against crashes, the assertion could be changed to one that is only present in debug builds. |