-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Classloader set by QuarkusTest breaks subsequent non-quarkus unit tests #22510
Comments
Thanks for reporting. This isn't actually an issue of The issue here is that the ForkJoin pool holds on to the TCCL... @cescoffier I think we have seen this before, right? |
This reproduces with Quarkus 2.6.1.Final as well. But it didn't with Quarkus 2.1.3.Final, which we are trying to upgrade from. |
Is this still an issue with Quarkus 3.14? |
Yes, the same error reproduces with Quarkus 3.14.1.
|
Thanks for checking |
In general, I discourage the usage of the Unfortunately, the common pool does not allow us to set a TCCL or to reset it. We can try a best-effort approach submitting n tasks (n == parallelism) to be executed in parallel. These tasks would reset the TTLC. It is quite fragile, as you have no guarantee that the TCCL is resetted on al the platform threads composing the common pool. |
You can use the one Quarkus manages by injecting it: @Inject ExecutorService executor; |
Describe the bug
I have a mix of @QuarkusTest-annotated tests and plain old junit tests in my project. The @QuarkusTest seems to set its thread context class loader on the ForkJoinPool.commonPool() and not clear it, so that subsequent non-Quarkus unit tests still see this class loader and are impacted by it.
It causes different kinds of
java.util.concurrent.CompletionException: java.util.ServiceConfigurationError: BLAH-BLAH-BLAH not a subtype
I've prepared a minimal reproducer: https://github.com/vladykin/quarkus-test-classloader-issue
If the QTest runs before PlainOldTest, then PlainOldTest fails with
If they execute in reverse order, they both pass.
Expected behavior
@QuarkusTest should not impact other non-Quarkus tests in the project.
Actual behavior
No response
How to Reproduce?
mvn clean package
and see the same failure@Ordered
annotation to make the failure go awayOutput of
uname -a
orver
Linux 5.14.21-gentoo #9 SMP Wed Dec 15 22:26:07 PST 2021 x86_64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz GenuineIntel GNU/Linux
Output of
java -version
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment Zulu16.30+15-CA (build 16.0.1+9)
OpenJDK 64-Bit Server VM Zulu16.30+15-CA (build 16.0.1+9, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.5.4.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.6.3
Additional information
No response
The text was updated successfully, but these errors were encountered: