Open brice-laurencin opened 1 year ago
/cc @FroMage (context-propagation), @evanchooly (kotlin), @geoand (kotlin), @manovotn (context-propagation)
@brice-laurencin This same issue has been mentioned on stack overflow before. I think the reason context couldn't be propagated was because by nature parallelstream runs operations on the JVM's default ForkJoinPool of threads, which are not managed by Quarkus but the JVM itself.
@brice-laurencin This same issue has been mentioned on stack overflow before. I think the reason context couldn't be propagated was because by nature parallelstream runs operations on the JVM's default ForkJoinPool of threads, which are not managed by Quarkus but the JVM itself.
If that's the case then you are correct. The default ForkJoinPool cannot propagate contexts.
Thanks! I'll test that.
Well, what people said here is true. But the symptom here is that there's a ClassLoader issue, leading to two instances of the class ThreadContextProvider
to be loaded and incompatible. Now, perhaps it's a side-effect of the usage of parallelStream
, but it's a bit weird.
Describe the bug
Trying the handle a collection from with
parallelStream
, calling a rest microprofile service ends up failing withjava.util.ServiceConfigurationError: org.eclipse.microprofile.context.spi.ThreadContextProvider: io.smallrye.context.jta.context.propagation.JtaContextProvider not a subtype
Expected behavior
Parallel processing works
Actual behavior
fails with
java.util.ServiceConfigurationError: org.eclipse.microprofile.context.spi.ThreadContextProvider: io.smallrye.context.jta.context.propagation.JtaContextProvider not a subtype
after a few callsHow to Reproduce?
run tests from https://github.com/brice-laurencin/quarkus-context-propagation-issue
Output of
uname -a
orver
Linux brice-work 6.2.0-32-generic #32-Ubuntu SMP PREEMPT_DYNAMIC Mon Aug 14 10:03:50 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)
GraalVM version (if different from Java)
n/a
Quarkus version or git rev
3.2.2.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)------------------------------------------------------------ Gradle 8.1.1 ------------------------------------------------------------ Build time: 2023-04-21 12:31:26 UTC Revision: 1cf537a851c635c364a4214885f8b9798051175b Kotlin: 1.8.10 Groovy: 3.0.15 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM: 17.0.7 (Eclipse Adoptium 17.0.7+7) OS: Linux 6.2.0-32-generic amd64
Additional information
It kind of works when there is no JPA/Hibernate in the project. I had to add the actual DB to reproduce the issue I faced with my actual project.