quartz-scheduler / quartz

Code for Quartz Scheduler
http://www.quartz-scheduler.org
Apache License 2.0
6.29k stars 1.94k forks source link

Failure obtaining db row lock: Lock wait timeout exceeded; try restarting transaction #1120

Closed songjh513 closed 1 month ago

songjh513 commented 6 months ago

Failure obtaining db row lock: Lock wait timeout exceeded; try restarting transaction mysql 5.7

props : prop.put("org.quartz.scheduler.instanceName", scheduledTaskProperties.getProjectId() + "-scheduler"); prop.put("org.quartz.scheduler.instanceId", getInstanceId()); prop.put("org.quartz.scheduler.skipUpdateCheck", "true"); prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore"); prop.put("org.quartz.jobStore.driverDelegateClass", "org.quartz.impl.jdbcjobstore.StdJDBCDelegate"); String tablePrefix = "qrtz"; if (StringUtil.isNotEmpty(scheduledTaskProperties.getTablePrefix())) { tablePrefix = scheduledTaskProperties.getTablePrefix() + "" + tablePrefix; } prop.put("org.quartz.jobStore.tablePrefix", tablePrefix); prop.put("org.quartz.jobStore.isClustered", "true"); prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000"); prop.put("org.quartz.jobStore.misfireThreshold", "60000"); prop.put("org.quartz.jobStore.acquireTriggersWithinLock", "true"); prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "40"); prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS WHERE SCHED_NAME = {1} AND LOCK_NAME = ? FOR UPDATE"); prop.put("org.quartz.jobStore.lockHandler.class", "org.quartz.impl.jdbcjobstore.StdRowLockSemaphore"); prop.put("org.quartz.jobStore.lockHandler.maxRetry", "7"); prop.put("org.quartz.jobStore.lockHandler.retryPeriod", "5000"); prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool"); prop.put("org.quartz.threadPool.threadCount", scheduledTaskProperties.getThreadCount()); prop.put("org.quartz.threadPool.threadPriority", Thread.NORM_PRIORITY);

how to resolve ?

jhouserizer commented 1 month ago

Too little info here to act on (stack trace? reproducible test? etc.), and this issue is no several months old. please open new issue with more info if needed.