Skip to content

Transactional Quartz jobs with WARN messages in the log: Datasource '<default>': Closing open connection prior to commit #27168

Open
@szxp

Description

Describe the bug

I am trying to schedule Quartz jobs programmatically using @Transactional, similar to as suggested in https://quarkus.io/guides/quartz#scheduling-jobs-programmatically, but WARN messages can be seen in the log: Datasource '<default>': Closing open connection prior to commit:

Listening for transport dt_socket at address: 5005
2022-08-06 20:56:12,046 WARN  [io.qua.hib.orm.dep.HibernateOrmProcessor] (build-2) Hibernate ORM is disabled because no JPA entities were found
2022-08-06 20:56:12,428 INFO  [io.qua.arc.pro.BeanProcessor] (build-5) Found unrecommended usage of private members (use package-private instead) in application beans:
        - @Inject field com.example.MyScheduler#dataSource,
        - @Inject field com.example.MyScheduler#quartz,
        - @Inject field com.example.MyScheduler#transactionManager
        - and 2 more - please enable debug logging to see the full list

__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2022-08-06 20:56:13,218 INFO  [com.exa.MyScheduler] (QuarkusQuartzScheduler_Worker-1) Execute: scheduler1

2022-08-06 20:56:13,218 INFO  [io.quarkus] (Quarkus Main Thread) module1 1.0.0 on JVM (powered by Quarkus 2.7.6.Final) started in 1.961s.
2022-08-06 20:56:13,223 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-08-06 20:56:13,224 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, hibernate-orm, hibernate-orm-panache, hibernate-validator, jdbc-h2, narayana-jta, quartz, scheduler, smallrye-context-propagation, vertx]
2022-08-06 20:56:13,338 INFO  [com.exa.MyScheduler] (QuarkusQuartzScheduler_Worker-1) conn: wrapped[conn0: url=jdbc:h2:mem:MyDB user=DBUSER]
2022-08-06 20:56:13,340 INFO  [com.exa.MyScheduler] (QuarkusQuartzScheduler_Worker-1) txman status: 6
2022-08-06 20:56:13,370 INFO  [com.exa.MyScheduler$MyJob] (QuarkusQuartzScheduler_Worker-2) Execute: job
2022-08-06 20:56:13,378 INFO  [com.exa.MyScheduler$MyJob] (QuarkusQuartzScheduler_Worker-2) conn: wrapped[conn1: url=jdbc:h2:mem:MyDB user=DBUSER]<<enrolled
2022-08-06 20:56:13,379 INFO  [com.exa.MyScheduler$MyJob] (QuarkusQuartzScheduler_Worker-2) txman status: 0
2022-08-06 20:56:13,379 INFO  [com.exa.MyScheduler$MyJob] (QuarkusQuartzScheduler_Worker-2) txm status: 0
2022-08-06 20:56:13,380 WARN  [io.agr.pool] (QuarkusQuartzScheduler_Worker-2) Datasource '<default>': Closing open connection prior to commit
2022-08-06 20:56:16,343 INFO  [com.exa.MyScheduler$MyJob] (QuarkusQuartzScheduler_Worker-3) Execute: job
2022-08-06 20:56:16,346 INFO  [com.exa.MyScheduler$MyJob] (QuarkusQuartzScheduler_Worker-3) conn: wrapped[conn1: url=jdbc:h2:mem:MyDB user=DBUSER]<<enrolled
2022-08-06 20:56:16,349 INFO  [com.exa.MyScheduler$MyJob] (QuarkusQuartzScheduler_Worker-3) txman status: 0
2022-08-06 20:56:16,351 INFO  [com.exa.MyScheduler$MyJob] (QuarkusQuartzScheduler_Worker-3) txm status: 0
2022-08-06 20:56:16,352 WARN  [io.agr.pool] (QuarkusQuartzScheduler_Worker-3) Datasource '<default>': Closing open connection prior to commit

Expected behavior

No WARN messages in the log.

Actual behavior

WARN messages can be seen in the log:

Datasource '<default>': Closing open connection prior to commit

How to Reproduce?

Sample project
https://github.com/szxp/quartz-test/blob/main/module1/src/main/java/com/example/MyScheduler.java

Run this Maven command in the module1 directory from Windows Powershell:
mvn clean compile quarkus:dev -"Dquarkus.quartz.start-mode=forced"

Output of uname -a or ver

Microsoft Windows [Version 10.0.22000.795]

Output of java -version

openjdk 17.0.2 2022-01-18 OpenJDK Runtime Environment GraalVM CE 22.0.0.2 (build 17.0.2+8-jvmci-22.0-b05) OpenJDK 64-Bit Server VM GraalVM CE 22.0.0.2 (build 17.0.2+8-jvmci-22.0-b05, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.7.6.Final

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

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63) Maven home: c:\Users\szp05\local\apache-maven-3.8.6 Java version: 17.0.2, vendor: GraalVM Community, runtime: c:\Users\szp05\local\graalvm-ce-java17-22.0.0.2 Default locale: en_US, platform encoding: Cp1252 OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions