Before we start, yes, I know using Ruby's Timeout is a horrible idea. But this is more of a thought experiment.
Let's say I have some Ruby code wrapped in a Timeout::timeout
block that does a whole bunch of SQL transactions (via ActiveRecord), from SELECT
s, UPDATE
s and INSERT
s. Given the nature of Timeout
, we could abort in the midst of preparing or waiting for a SQL transaction to finish.
In theory, if the request to the DB is sent before the Ruby timeout interrupt, the transaction would complete on the DB but the client just wouldn't be able to respond to the completion. And of course, depending on the context of the Ruby code, the data could ultimately be incomplete if there are subsequent transactions needed in order for my model to be considered complete and stable, and whatever other possible side effects due to the code not finishing fully.
Are there any other possible dangers or side effects to be concerned with? Is there a chance the transaction could hang or fail in some other way? Or is there just too much contextual level knowledge needed about the data and application to say?