I posted this message on the mysql forum: http://forums.mysql.com/read.php?97,167771,167771 and the ruby code in question uses the mysql-2.7 gem directly. Not using active record. When the deadlock occurs it takes about 2 mins and times out with an error. But if the run the same SQL in mysql console with two sessions, I get a deadlock error right away. Is there a way to make the ruby mysql gem return the deadlock error without the 2 min wait? Thanks. -- Posted via http://www.ruby-forum.com/.