简体   繁体   中英

Deadlock found when trying to get lock; try restarting transaction Could not synchronize database state with session

Deadlock found when trying to get lock; try restarting transaction
Could not synchronise database state with session

org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update.

This exception is occurring several times, certain documents says its related to mysql lock wait timeout, here its set to default value 50.
please give a clear answer whether the issue is actually related to lock wait timeout or anything else, and will this issue be resolved by increasing the lock wait timeout to 150 - 200.

The deadlock condition implies that your transactions are trying to acquire lock in different order. Increasing the timeout will not solve the actual problem. You can go deeper into the deadlock cause by running " SHOW ENGINE INNODB STATUS " and it will show the transactions involved in deadlock and what sql they were running. For more details check the docs here and helpful guide to debug deadlock issues here . One useful information from the docs is that one useful way to solve the deadlock is retyring too, but it is always worth to find the root cause and solve that.

Always be prepared to re-issue a transaction if it fails due to deadlock. Deadlocks are not dangerous. Just try again

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM