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

Unused Narayana is started upon application start #27982

Closed
kdubb opened this issue Sep 16, 2022 · 12 comments · Fixed by #28025
Closed

Unused Narayana is started upon application start #27982

kdubb opened this issue Sep 16, 2022 · 12 comments · Fixed by #28025
Labels
Milestone

Comments

@kdubb
Copy link
Contributor

kdubb commented Sep 16, 2022

Describe the bug

mongodb-panache-common adds the narayana-jta extension. Although added, the transaction manager was never used and thus not started.

As of 2.13.0.CR1 the transaction manager is started nearly immediately at startup

Expected behavior

Narayana is not started if not used.

Additionally, it would be nice to not have it included if it's not going to be used.

Actual behavior

Narayana JTA is started almost immediately on startup.

In an application with Flyway enabled, the JTA is started prior to running migrations and a message is produced.

20:29:15 INFO  ARJUNA032010: JBossTS Recovery Service (tag: 518c8dd50a9ae8e70eb15dfe8fc764adcabef8ab) - JBoss Inc.
20:29:15 INFO  ARJUNA032013: Starting transaction recovery manager
20:29:15 INFO  Flyway Community Edition 9.3.0 by Redgate

In applications without Flyway no message is produced but the application creates the telltale ObjectStore directory indicating that some portion of the JTA is starting.

How to Reproduce?

Add mongodb-panache to an application to you'll see ObjectStore directories.

Additionally add Flyway and observe the logging related to started the JTA.

Output of uname -a or ver

macOS 12.6

Output of java -version

OpenJDK 17.0.1

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.13.0.CR1

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

Gradle 7.5.1

Additional information

No response

@kdubb kdubb added the kind/bug Something isn't working label Sep 16, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Sep 16, 2022

/cc @cristhiank, @gastaldi, @geoand, @gsmet

@kdubb kdubb changed the title Unused Narayana is started by Flyway Unused Narayana is started upon application start Sep 16, 2022
@geoand
Copy link
Contributor

geoand commented Sep 16, 2022

cc @loicmathieu who added the transaction support for Mongo

@loicmathieu
Copy link
Contributor

@mmusgrov @gsmet does something changed on the Narayana side that can cause this issue ?
@kdubb does it creates a real issue or it's just an observation that it is started now and not before ?

@kdubb
Copy link
Contributor Author

kdubb commented Sep 16, 2022

Everything works but I would argue that spending time starting unused subsystems is a "real" issue for Quarkus.

@kdubb
Copy link
Contributor Author

kdubb commented Sep 16, 2022

@gsmet Here is a reproducer using Gradle. This was created by code.querkus.io, no code changes were made at all.

To reproduce, start the app (I used quarkus dev) and all will seem correct but after quitting the application (using q) the ObjectStore directory structure will be created in the root project directory.

gradle-object-store-at-quit.zip

Downgrading to any 2.12 series and this behavior goes away; no directories are created at exit.

@gsmet
Copy link
Member

gsmet commented Sep 16, 2022

Are you sure the transaction manager was not started? Or was it more that it wasn't logging anything so you didn't know it was started? (honest question)

@kdubb
Copy link
Contributor Author

kdubb commented Sep 16, 2022

Only because in the 2.12 series no directories are created at any time and no startup messages are logged. I'm going to add Flyway to the above example and you'll see both startup log messages and the ObjectStore is created at that point rather than at exit.

@kdubb
Copy link
Contributor Author

kdubb commented Sep 16, 2022

Here is Maven. It has the exact same behavior as the Gradle reproducer above. For Maven I used man quarkus:dev to start the app.
maven-object-store-at-quit.zip

@kdubb
Copy link
Contributor Author

kdubb commented Sep 16, 2022

This is Maven with Flyway. I added a small simple migration. Started app using mvn quarkus:dev again.

In this case you will see the Narayana/Arjuna startup messages, as well as ObjectStore creation, during initialization and prior to Flyway's migrations.
maven-flyway-object-store-at-start.zip

Again, downgrading to 2.12 series and no log messages are seen nor is the ObjectStore created at any time.

@geoand
Copy link
Contributor

geoand commented Sep 20, 2022

@gsmet are you looking at this one?

@mmusgrov
Copy link
Contributor

Narayana checks the transaction logs to determine whether or not there are in doubt transactions that may need to be recovered.

@gsmet
Copy link
Member

gsmet commented Sep 20, 2022

I think we found a good compromise for 2.13 here: #28025 .

More involved changes will have to be made in 2.14.

@quarkus-bot quarkus-bot bot added this to the 2.14 - main milestone Sep 20, 2022
@gsmet gsmet modified the milestones: 2.14 - main, 2.13.0.Final Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants