title: What happens if thread that called "SELECT FOR UPDATE" dies? Is the row locked forever?
body: <p>I have a multi-threaded application that locks and unlock rows in one of my MYSQL table. As an example, all my threads that interact with this table call <code>SELECT ... FOR UPDATE;</code> followed by <code>UPDATE ...</code> sometime later. I am worried what would happen if the thread that took the exclusive lock by calling <code>SELECT ... FOR UPDATE</code> dies and never manages to call the <code>UPDATE ...</code> that would release the lock. Then would I have a deadlock? Is there a way to force the lock to be released if the thread who has the lock dies?</p>