Process possessing lock crashes I have two machines, M1 and M2, through which I am connecting to MySQL Database on machine M3 using Perl script (DBI.pm). 

So, here is the scenario that I am confused about: 
M1 places a table level lock, and performs some operations. M2 also does the same. Table level locking mechanism is guarantying me that both of them will not be locking the table at the same time. 

But, what if M1 has locked the table, and suddenly after performing half hte updates, the machine crashes or the Perl script process crashes, what happens to the lock then? My updates were performed mid-way, do those get rolled back? And what is the best way to deal with these kind of locks?
http://dev.mysql.com/doc/refman/5.6/en/innodb-autocommit-commit-rollback.html


  If a session that has autocommit disabled ends without explicitly committing the final transaction, MySQL rolls back that transaction.


There is a process that monitors active sessions. If any are found to have disconnected, the sessions are cleaned up. This includes rollback of uncommitted transactions.