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

@Transactional should not override @RunOnVirtualThread in reasteasy reactive #34319

Closed
imperatorx opened this issue Jun 26, 2023 · 12 comments
Closed
Assignees
Labels
area/narayana Transactions / Narayana kind/enhancement New feature or request

Comments

@imperatorx
Copy link
Contributor

Describe the bug

PR #24942, as choice of caution, disables virtual threads when @Transactional is added to a reasteasy reactive method. Narayana will soon (7.0) have support for virtual threads (jbosstm/narayana#2077), so I think this restriction should go away for those who want to experiment with or build on this.

With narayana built from trunk and a loom friendly jdbc driver, @RunOnVirtualThread works if the method is not annotated with @Transactional, but there is programmatic transaction control inside using QuarkusTransaction.requiringNew().

Expected behavior

@Transactional
@RunOnVirtualThread
public String foo() {
  // access SQL datasource or cusom XA resouce here works, transaction is present
  // is executed on a virtual thread
}

Actual behavior

@Transactional
@RunOnVirtualThread
public String foo() {
  // access SQL datasource or cusom XA resouce here works, transaction is present
  // is executed on the main thread pool instead of a virtual thread
}

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

19

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.1.2.Final

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

No response

Additional information

No response

@imperatorx imperatorx added the kind/bug Something isn't working label Jun 26, 2023
@geoand geoand added kind/enhancement New feature or request area/narayana Transactions / Narayana and removed triage/needs-triage kind/bug Something isn't working labels Jun 27, 2023
@geoand
Copy link
Contributor

geoand commented Jun 27, 2023

cc @cescoffier @franz1981

@franz1981
Copy link
Contributor

AFAIK narayana is now pinnnig the virtual thread; maybe a fix is in flight for that.

@geoand
Copy link
Contributor

geoand commented Jun 27, 2023

That is what I think the issue is saying

@imperatorx
Copy link
Contributor Author

imperatorx commented Jun 27, 2023

AFAIK narayana is now pinnnig the virtual thread; maybe a fix is in flight for that.

It is, I made the pr (merged):

Narayana will soon (7.0) have support for virtual threads (jbosstm/narayana#2077),

@cescoffier
Copy link
Member

Yes, it got fixed last week. So we can finally improve.

Do you know when we would be able to update narayana? Because that's what will drive the change.

@imperatorx
Copy link
Contributor Author

imperatorx commented Jun 29, 2023

Do you know when we would be able to update narayana? Because that's what will drive the change.

They said it will be in 7.x as some public methods got their synchronized flags removed (public API change)

@imperatorx
Copy link
Contributor Author

Also, what are the plans regarding virtual threads and classic resteasy integration? It seems virtual threads are a better fit for blocking (non-reactive) semantics.

@mmusgrov
Copy link
Contributor

The plan is to release Narayana with @imperatorx 's enhancement this week.

@imperatorx
Copy link
Contributor Author

7.0.0.Final was released: https://search.maven.org/search?q=g:org.jboss.narayana.jta

@mmusgrov
Copy link
Contributor

The quarkus component upgrade PR has nearly completed its checks.

@cescoffier
Copy link
Member

I just merged the narayana update - will lift the limitation tomorrow

@cescoffier cescoffier self-assigned this Jul 17, 2023
@cescoffier
Copy link
Member

Fixed with #34808

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/narayana Transactions / Narayana kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants