如何解决MySQL锁定超时错误?

时间:2015-05-19 10:33:37

标签: java mysql jdbc timeout rowlocking

我在应用程序日志中多次出现以下列出的错误。

2015-05-19 10:27:57,842 ERROR [Timer-3] [org.hibernate.util.JDBCExceptionReporter] Lock wait timeout exceeded; try restarting transactionCouldn't retrieve InnoDB stat
us due to underlying exception:

BEGIN NESTED EXCEPTION **
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException
MESSAGE: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation

STACKTRACE:

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)

我知道当一个线程锁定了特定的表行,并且第二个线程正在等待它并且这个等待时间超过一定的时间时,就会发生这个错误。

但是如何优化MySQL配置或我的代码来克服这种情况?

我已经阅读了有关隔离级别的this article,我已经将隔离级别设置为READ COMMITTED

有没有专家建议/解决方案而不是我提到的?

0 个答案:

没有答案