Lock wait timeout exceeded; try restarting transaction
一 概述
今天在本地debug代码的时候,没有断点执行完毕,导致测试环境前端调用测试服务器服务的时候出现了问题:
org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: Retail_HikariCP - Connection is not available, request timed out after 30000ms.
com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction。
二 原因分析
因为测试服务器和本地代码连接的数据库一致,debug锁表同时数据的连接池无法被释放导致连接无法继续获得连接池中的连接。
基于此我将debug的断点放开执行完后,问题就自然的解决了。
个人粗略的理解,如有更深入的理解望各位告知…
还没有评论,来说两句吧...