Spot dead locks:

Record the PID of the lock owner, and check if the PID still exists when we fail to obtain the lock.
again, a comment would also be welcome here