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

Jobs not executing concurrently, with a quartz error #1690

Open
fishfacemcgee opened this issue Jan 10, 2025 · 1 comment
Open

Jobs not executing concurrently, with a quartz error #1690

fishfacemcgee opened this issue Jan 10, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@fishfacemcgee
Copy link

Bug description 🐞

When multiple jobs are created simultaneously, only one is executed at a time instead of concurrently. The logs on the API container included this:

2025-01-10T19:48:35.444Z ERROR 1 --- [SchedulerThread] org.quartz.core.ErrorLogger              : An error occurred while scanning for the next triggers to fire.

org.quartz.JobPersistenceException: Couldn't acquire next trigger: Cannot invoke "org.quartz.JobDetail.isConcurrentExecutionDisallowed()" because "job" is null
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2818) ~[quartz-2.5.0.jar:2.5.0]
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.lambda$acquireNextTriggers$13(JobStoreSupport.java:2703) ~[quartz-2.5.0.jar:2.5.0]
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3736) ~[quartz-2.5.0.jar:2.5.0]
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2702) ~[quartz-2.5.0.jar:2.5.0]
	at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:294) ~[quartz-2.5.0.jar:2.5.0]
Caused by: java.lang.NullPointerException: Cannot invoke "org.quartz.JobDetail.isConcurrentExecutionDisallowed()" because "job" is null
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2769) ~[quartz-2.5.0.jar:2.5.0]
	... 4 common frames omitted

Steps to reproduce

Trigger multiple Terrakube workspace jobs in the same Organization. Most of our Terraform repos are mono repos (where each environment has its own workspace) so pushing a commit with common files modified is the easiest.

Expected behavior

Two or more workspaces run concurrently instead of one at a time.

Example repository

No response

Anything else?

No response

@fishfacemcgee fishfacemcgee added the bug Something isn't working label Jan 10, 2025
@alfespa17 alfespa17 self-assigned this Jan 11, 2025
@alfespa17
Copy link
Member

alfespa17 commented Jan 11, 2025

I think you are correct I was running 3 at the same time and the jobs were executed sequentially

image

I think it is related to this configuration

https://github.com/quartz-scheduler/quartz/blob/1d1f4c5bc2ebec1fa7bb0a8561088a8723c248aa/docs/configuration.adoc#configuration-of-jdbc-jobstoretx-store-jobs-and-triggers-in-a-database-via-jdbc

Specially using the following properties

org.quartz.scheduler.batchTriggerAcquisitionMaxCount
org.quartz.jobStore.acquireTriggersWithinLock

This could be updated in this file

properties.put("org.quartz.jobStore.class","org.springframework.scheduling.quartz.LocalDataSourceJobStore");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants