-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 Quartz Extension not working with Micosoft SQL server since 3.2.x #38769
Comments
/cc @machi1990 (quartz), @mkouba (quartz) |
able to reproduct quickly with sample code : https://github.com/quarkusio/quarkus-quickstarts/tree/main/quartz-quickstart
|
Apparently it's not a Quarkus-specific issue - see for example quartz-scheduler/quartz#669. The suggested solution is to use a different SQL select for MS SQL server: |
@mkouba - Thanks for the quick reply. Do you have any idea why this issue started only after Quarkus 3.2.x? It was working fine until Quarkus 3.1.x Also, I just tried adding this property in application.properties but still see the same, Do you have any further thoughts or help on this? quarkus.quartz.select-with-lock-sql=SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ? |
I have no idea. The quartz version is the same in 3.1 and 3.2.
Can you see the same exception? |
@mkouba - Yes, I see the same exact error even after I adding that property, I am thining somehow that is not getting applied |
@mkouba - I see a lot of differences in the Quartz package between 3.1.3 and. 3.2.0, seems some of the refactoring causing the issue, see below screenshots |
@chvsnraju I can see the problem now. There was an issue introduced in #33534 (3.2.0.CR1) and it was fixed in #35255 (3.2.4.Final). So an upgrade to Quarkus |
@mkouba - Thanks for checking, I tried with 3.2.4.Final as well latest 3.7.2 with both the below property and without the property but still getting same issue, not sure if I am missing anything quarkus.quartz.select-with-lock-sql=SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ? Caused by: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.] |
I see. Well, then I'm running out of ideas... I suppose that you have the |
@mkouba - thanks, Here is my properties file, it is just Quarkus sample code for Quartz, just changed to mssql. The project is working fine when I switch to 3.1.3 but anything beyond 3.2.x is not working. quarkus.scheduler.start-mode=forced quarkus.hibernate-orm.database.generation=none quarkus.flyway.connect-retries=10 quarkus.datasource.db-kind=mssql |
Hm, your |
@mkouba - Thank you very much; you are the savior, finally able to make it work with combination of these properties, if one of them not there, I still see same error, thanks again, we are good now quarkus.quartz.clustered=true |
@mkouba - Do you want me to close this, or will this be addressed in future releases without additional SQL as property? |
Well, I'm not quite sure if this should be addressed in Quarkus. The original issue looks like a bug in Quartz MS SQL integration - so the special select is not something we should add in Quarkus. And the fact that |
Describe the bug
We use Quartz scheduler for our cronjob executions. We started with Quarkus 2.6.x, and it is working until 3.1.x. When we migrated to 3.2.x, we see startup failures with the below exception. I tried with the latest 3.7.x, any help will be greatly appreciated.
It worked fine until 3.1.x, getting below exception anything 3.2.x beyond; I see some refactoring in the Quartz package with 3.2.x, but I need help finding the exact issue.
Can reproduce with docker mssql server container; we are on Java 17 with Hibernate.
15:47:11 ERROR {} [io.qu.ru.Application] (Quarkus Main Thread) (null) IP= reqId= Failed to start application (with profile {0}): java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:113)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalStateException: Unable to start Scheduler
at io.quarkus.quartz.runtime.QuartzSchedulerImpl.start(QuartzSchedulerImpl.java:511)
at io.quarkus.quartz.runtime.QuartzSchedulerImpl_Observer_start_H-6XoNLvj3wcGgHUsn1YAKHoJeM.notify(Unknown Source)
at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:346)
at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:328)
at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:82)
at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:155)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:106)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
... 13 more
Caused by: org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.]]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.schedulerStarted(JobStoreSupport.java:697)
at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:539)
at org.quartz.impl.StdScheduler.start(StdScheduler.java:142)
at io.quarkus.quartz.runtime.QuartzSchedulerImpl.start(QuartzSchedulerImpl.java:509)
Expected behavior
Quartz Scheduler should work with Microsoft SQL Servers
Actual behavior
Having startup issues with Quarkus 3.2.x and beyond
How to Reproduce?
Use Quartz Scheduler extension
Create latest Microsoft SQL server docker container
load initial SQL server db scripts
startup the Quarkus servever
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: