1
我有一個石英+ mysql + tomcat7 Lock wait timeout exceeded
的問題。當我爲dev和qa使用一臺服務器時,我面臨的問題沒有出現,但是在部署之後,我開始在生產環境中看到一個問題(使用2臺服務器)。quartz + mysql - 引發者:java.sql.SQLException:超出鎖定等待超時;嘗試重新啓動交易
org.quartz.JobPersistenceException: Couldn't store trigger 'trigger1355274000000' for '1355274000000' job:Lock wait timeout exceeded; try restarting transaction [See nested exception: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1270)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.triggerFired(JobStoreSupport.java:2961)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$38.execute(JobStoreSupport.java:2871)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3788)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.triggerFired(JobStoreSupport.java:2865)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:319)
Caused by: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2046)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1964)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1949)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.updateTrigger(StdJDBCDelegate.java:1295)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1256)
這是我的石英配置。
org.quartz.scheduler.instanceName = ApplicationDemoScheduler
org.quartz.scheduler.instanceId = AUTO
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=10
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
org.quartz.scheduler.threadsInheritContextClassLoaderOfInitializer=true
org.quartz.jobStore.misfireThreshold=180000
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.useProperties=false
org.quartz.jobStore.dataSource=qzDS
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.jobStore.isClustered=true
org.quartz.jobStore.selectWithLockSQL=select LOCK_NAME from QRTZ_LOCKS where LOCK_NAME=?
org.quartz.jobStore.clusterCheckinInterval = 20000
org.quartz.scheduler.dbFailureRetryInterval=15000
org.quartz.dataSource.qzDS.jndiURL=java:comp/env/jdbc/appDemoJndi
而此數據源引用Tomcat中配置的數據源。
<Resource name="jdbc/appDemoJndi" auth="Container" type="javax.sql.DataSource"
username="testuser" password="test_pswd"
url="jdbc:mysql://localhost/testuser"
driverClassName="com.mysql.jdbc.Driver"
initialSize="20" maxWait="5000"
maxActive="40" maxIdle="5"
testWhileIdle="true"
testOnBorrow="true"
defaultAutoCommit="false"
maxOpenPreparedStatements="20"
validationQuery="select 1"
poolPreparedStatements="true"/>
我不依賴任何休眠或任何東西。我不太確定這個錯誤是否與任何石英配置或MYSQL配置有關。
有沒有人有過同樣的問題並解決了它?請幫忙...
謝謝。
檢查在mysql中的未決鎖定來自MySQL的。你還有別的東西能訪問那些可能導致鎖定的表嗎?你在QRTZ_LOCKS有奇怪的事嗎? – poussma
此代碼僅用於後端區域。所以根據我的理解,我不認爲這張桌子是從其他地方使用的。我想知道是否因爲其他服務器具有相同的配置。在LOCK表中,我看到了CALENDAR_LOCK,JOB_ACCESS,MISFIRE_ACCESS,STATE_ACCESS,TRIGGER_ACCESS。 – user826323
您是否找到了解決辦法? –