Slow IO breaching the ActiveRecord transaction timeout
Performing heavy IO in ActiveRecord callbacks can cause problems with the callback flow. As explained by @engwan, the issue is, in essence, that performing an action in a callback which has the possibility of taking a long time but not failing (e.g. a Gitaly operation) can cause the parent ActiveRecord transaction to time out, as the callbacks are executed within that transaction. Example flow from @engwan:
- BEGIN TRANSACTION ...
- INSERT INTO ...
- after_save doing git operations taking a long time but didn't timeout so no exception
- after_save to create metrics fails because the DB closed the transaction and rolled back but the Ruby side doesn't know about it until it tries to insert here and it's actually "outside" the transaction now.
Related !32668 (merged)
This issue has two purposes:
- Identify areas where this can happen
- Figure out what solutions are available to us
Edited by Robert May