Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quarkus job (Scheduled annotation) ignored quartz annotation DisallowConcurrentExecution #30781

Closed
xumk opened this issue Feb 1, 2023 · 4 comments
Labels
area/scheduler kind/bug Something isn't working

Comments

@xumk
Copy link
Contributor

xumk commented Feb 1, 2023

Describe the bug

Multiple triggers for a single job detail execute concurrently for a job annotated with @DisallowConcurrentExecution when the triggers are scheduled for the same time and the scheduler is in a cluster.

Expected behavior

The job will not execute concurrently across the cluster

Cluster Host 1

2023-02-01 15:27:42 INFO  [com.tst.MyJob]] (MyJob_Worker-1) start

Cluster Host 2
nothing

database

SCHED_NAME JOB_NAME JOB_GROUP JOB_CLASS_NAME IS_DURABLE IS_CONCURRENT IS_UPDATE_DATA REQUESTS_RECOVERY
MyClusteredScheduler MyJob MyJob io.quarkus.quartz.runtime.QuartzScheduler$InvokerJob 1 1 0 0

Actual behavior

The job will execute concurrently across the cluster

Cluster Host 1

2023-02-01 15:27:42 INFO  [com.tst.MyJob]] (MyJob_Worker-1) start

Cluster Host 2

2023-02-01 15:27:52 INFO  [com.tst.MyJob]] (MyJob_Worker-5) start

database

SCHED_NAME JOB_NAME JOB_GROUP JOB_CLASS_NAME IS_DURABLE IS_CONCURRENT IS_UPDATE_DATA REQUESTS_RECOVERY
MyClusteredScheduler MyJob MyJob io.quarkus.quartz.runtime.QuartzScheduler$InvokerJob 0 0 0 0

How to Reproduce?

Job class

@ApplicationScoped
@DisallowConcurrentExecution
public class MyJob {
   @Inject
    Logger logger;

    @Scheduled(cron = "{my.job.cron.expr}", identity = "myJobTest",
            concurrentExecution = Scheduled.ConcurrentExecution.SKIP)
    public void myJobTest() throws Exception {
        logger.infov("start");
        Thread.sleep(30000);
        logger.infov("end");
    }

}

Quartz configuration

quarkus.quartz.clustered=true
quarkus.quartz.store-type=jdbc-tx
quarkus.quartz.instance-name=MyClusteredScheduler
my.job.cron.expr=0/10 * * ? * *

Output of uname -a or ver

Darwin cab-wsm-0279148 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:08:47 PST 2022; root:xnu-8792.61.2~4/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08) OpenJDK 64-Bit Server VM GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.11.2

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.1

Additional information

old issue is ignored

@xumk xumk added the kind/bug Something isn't working label Feb 1, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 1, 2023

/cc @machi1990 (quartz), @mkouba (quartz,scheduler)

@mkouba
Copy link
Contributor

mkouba commented Feb 1, 2023

org.quartz.DisallowConcurrentExecution has no effect if used on a bean class that declares a @Scheduled method; it's a Quartz-specific annotation that needs to be used to annotate a org.quartz.Job implementation class. You would need to use a custom job class (annotated with @DisallowConcurrentExecution) and schedule it programmatically.

Also note that concurrentExecution = Scheduled.ConcurrentExecution.SKIP will not work across the cluster either.

The #26062 might be related.

@xumk
Copy link
Contributor Author

xumk commented Feb 1, 2023

@mkouba
is it planned to modification for the annotation Scheduled in order to achieve similar behavior with the custom job class (annotatedwith @DisallowConcurrentExecution)?

@mkouba
Copy link
Contributor

mkouba commented Feb 1, 2023

@mkouba is it planned to modification for the annotation Scheduled in order to achieve similar behavior with the custom job class (annotatedwith @DisallowConcurrentExecution)?

It might be implemented in the context of #26062. But there is no plan so far.

@mkouba mkouba closed this as not planned Won't fix, can't repro, duplicate, stale Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/scheduler kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants