MySQL Forums
Forum List  »  InnoDB

MySQL 8.0: 1213 Deadlock not logged
Posted by: Paul L'Allier
Date: August 07, 2023 05:27PM

Hi,

I'm struggling to understand a deadlock I'm getting on my program and hoping someone can give me some pointers, please?

I have a suite of CI test running on my application, with tests running in parallel, 6 at a time. I've started to get tests failing for deadlock conditions (clearly I need to include code to retry the failures), but I'm not understanding why it's deadlocking. It only happen when the tests are run rapidly on my CI machine - I can't reproduce it on my dev machine.

When it fails, it's alway on an INSERT (wrapped in a transaction) into one particular table. That table only ever has INSERT or SELECT (either on the table alone or in a JOIN, but never INSERT ... FOR SHARE or INSERT ... FOR UPDATE]) and my code never UPDATEs or DELETEs anything in that table (or anywhere else). How could either those SELECT or INSERT statements be generating a row lock which could lead to a deadlock? Can you get a deadlock on an index update, perhaps? I assume you can't get an autogenerated ID clash even if you inserted two row at exactly the same time?

Despite the 1213 Deadlock error status, there's no deadlock reported in SHOW ENGINE INNODB STATUS and nothing in the error log when I switch on innodb_print_all_deadlocks. What are the situations that would cause a 1213 error to be returned but not logged, please?

Thank you for any thoughts and suggestions you have.
Paul

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL 8.0: 1213 Deadlock not logged
264
August 07, 2023 05:27PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.