1

Using InnoDB. I've read this article about the InnoDB locking model, but I could not find the answer to this question:

Do MySQL locks expire? If a process grabs a lock, will that process still hold the lock tomorrow?

My use case is what if my program has a rogue thread running, maybe it's killed, maybe it's alive. Is there any guarantee that that the lock will be released...ever?

  • Check this Maximum Transaction Timeout at MySQL Forum. I guess the answer continues to be no, they don't. The locks would expire when the transactions expire, and there's no timeout for them. I don't know if the transactions would abort when the client connection is lost, but even that doesn't seem to be sure... – joanolo Jun 14 '17 at 22:04
  • Thanks for the advice. Honestly a specification for this would be nice even if the verdict is non-deterministic – Guy Wilson Jun 14 '17 at 23:33
  • There are many types of locks. Please provide more context of what you are seeing. Also see innodb_lock_wait_timeout, which defaults to 50 seconds. – Rick James Jun 29 '17 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.