Closed mateuszjarzyna closed 2 years ago
Hi, I am sorry, bute there is not much I can do to help you. It seems like a MySql issue (maybe related to this one). You can try JdbcStorageAccessor
which works in autocommit mode (without transactions), it might help.
It works, thanks a lot!
For people in the future with the same problem: This is how the LockProvider looks like:
@Configuration
@EnableScheduling
@EnableSchedulerLock(defaultLockAtMostFor = "50s")
class SchedulerConfiguration {
@Bean
public LockProvider lockProvider(DataSource dataSource) {
return new JdbcLockProvider(dataSource, "spring_jobs_lock");
}
}
Also, there is a need to remove theshedlock-provider-jdbc-template
dependency and add a new one:
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-provider-jdbc</artifactId>
<version>${shedlock.version}</version>
</dependency>
I have a few "microservices" (java apps) that shares the database (and also the
spring_jobs_lock
table, but each job has different name). Each "microservice" is running on two nodes and has one scheduled job. I'm getting wired deadlock in my apps.Which version do you use
4.36.0
Which Lock Provider JDBC, full configuration below
}
Expected behavior Jobs should be run without exception.
Actual behavior Sometimes the job is running with no problem, sometimes I can see
Not executing 'my-job'. It's locked.
message, but sometimes I got the deadlock exception with no additional logs.I've also checked that when the exception occurs, the second node works fine, the job is executed
More details: Database:
mysql Ver 15.1 Distrib 10.4.24-MariaDB, for Linux (x86_64) using readline 5.1
Spring boot version: 2.6.1