Comments (6)
/cc @FroMage (context-propagation), @Ladicek (smallrye), @alesj (kafka), @cescoffier (kafka,mutiny), @jmartisk (smallrye), @jponge (mutiny), @manovotn (context-propagation), @ozangunalp (kafka), @phillip-kruger (smallrye), @radcortez (smallrye)
from quarkus.
We had a similar problem with Kafka serializer touching the managed Hibernate entity during a transaction but this one isn't it. If you remove the flush and only call persist the problem goes away. That way the entity is managed by Hibernate throughout the method calla but only persisted when the transaction is committed not before.
I don't know why flush causes the context propagation to include the Kafka sender thread inside the transaction. Maybe someone with more experience with context propagation can chime in.
from quarkus.
We are dealing with legacy DB, using IDENTITY id generator strategy, which causes flush on every new insert/persist :)
from quarkus.
I don't know what the problem is but I can comment on the symptom: You have started a transaction in one thread which then runs some code in another thread with context propagation enabled. When you commit the transaction, presumably from the first thread, the transaction manager is telling you that the second thread is still active and is running with the transaction associated.
If you don't need the second thread to run with the transaction then use your fix by clearing the transaction context, otherwise you could wait for this second thread to return before committing the transaction.
from quarkus.
I notice that the transaction manager is using "onePhaseCommit" which means there is only one resource involved in the transaction which I assume is the persisting of the JPA entity so it should be fine to clear the transaction context when doing the kafka call.
from quarkus.
I notice that the transaction manager is using "onePhaseCommit" which means there is only one resource involved in the transaction which I assume is the persisting of the JPA entity so it should be fine to clear the transaction context when doing the kafka call.
I 100% agree with everything written.
I applied the ugly fix, but still, I believe that this bug should be resolved asap.
I believe that the provided scenario is quite common. Al least in imperative world; write to db, write to kafka, wait ack, commit db tx.
And having a lib, that has 1:1000 chance of wierd failure is really not great.
While having little/no experience with reactive code and context propagation... I can only guess, what is holding the mutiny-kafka-producer thread bound to thread context after acking the message.
from quarkus.
Related Issues (20)
- [Extension Proposal] Quarkus Data Files HOT 3
- Kotlin Coroutine suspend function Integration uses single thread dispatcher HOT 1
- OTEL eventbus context HOT 1
- Spring-data throw JsonMappingException when using PageImpl HOT 3
- Overriding Kafka topic name using ENV variables fails with : SRMSG00071: Invalid channel configuration - the `connector` attribute must be set for channel HOT 5
- OidcClient concurrency test is a bit flaky
- Add Support for Caching List Results in Quarks Redis Cache HOT 1
- Class Not Found org/graalvm/polyglot/Value 1.4.1
- Application won't start when using hibernate select query with custom class HOT 2
- Managed executor thread has the AppClassLoader on HttpClient dependent task HOT 6
- Pinned thread on Vault fetch secret HOT 9
- Pinned thread when selecting an instance from Arc HOT 9
- Accessing a management endpoint after a live reload leads to an exception (when Hibernate Search Standalone mapper is used) HOT 3
- Live reloading an app with `quarkus-hibernate-search-standalone-elasticsearch` results in `UncaughtExceptions` being logged HOT 4
- Add async callback support for Quarkus WebSockets Next HOT 2
- Upgrade `ubi8/openjdk-VERSION:1:19` -> `ubi8/openjdk-VERSION:1:20`
- Unable to build the codebase with mvnd 1.0.0 HOT 1
- gradlew quarkusRun failed with error "Failed to index: io.quarkus.test.TestReactiveTransaction"
- WebSockets Next: fire CDI events for each client connection added/removed
- Panache Entities extending an abstract class use wrong table mapping and throw errors on query execution
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quarkus.