Bug #62221 Possible race condition at row_ins_check_foreign_constraints()
Submitted: 22 Aug 2011 4:46 Modified: 22 Aug 2011 12:59
Reporter: Yasufumi Kinoshita Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S3 (Non-critical)
Version:5.1.58, 5.5.15 OS:Any
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D3 (Medium)

[22 Aug 2011 4:46] Yasufumi Kinoshita
Description:
In the row_ins_check_foreign_constraints(),
---------------
                        if (foreign->referenced_table == NULL) {
                                dict_table_get(foreign->referenced_table_name,
                                               FALSE);
                        }

                        if (0 == trx->dict_operation_lock_mode) {
                                got_s_lock = TRUE;

                                row_mysql_freeze_data_dictionary(trx);
                        }
---------------
reading foreign->referenced_table needs row_mysql_freeze_data_dictionary(trx) at least, in exactly.

How to repeat:
It might be race condition of rare case.

Suggested fix:
row_upd_check_references_constraints() seems good,
row_mysql_freeze_data_dictionary() is called before while().

row_ins_check_foreign_constraints() should be aligned with the same way at row_upd_check_references_constraints()
[22 Aug 2011 12:59] Valeriy Kravchuk
Thank you for the problem report. Verified by code review of current mysql-5.5 tree.
[18 Jun 2013 14:02] Shane Bester
Is this bug still valid after the fixes for:
Bug 13635833 - MULTIPLE CRASHES IN FOREIGN KEY CODE WITH CONCURRENT DDL/DML ?