-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 Leak using TestProfiles (OutOfMemoryError: Metaspace) #38774
Comments
/cc @geoand (testing) |
I don't want to be a "I'm having this problem too" commentator, but ... I'm having this problem too. But with only three profiles, each applied to a different test case/test class. Just for an idea of the scope: real-world project, kotlin and gradle, two entities, few endpoints, 23 passing tests and good coverage (this service is very CRUD-like). (A useful utility microservice that does a single, small job well.) I then introduced three test profiles that configure two properties differently, such as: class NoSsiIssuanceV1Profile: QuarkusTestProfile {
override fun getConfigOverrides(): Map<String, String> {
return mapOf(
"quarkus.rest-client.ssi-issuance-v1-api.url" to "",
"quarkus.rest-client.ssi-issuance-v2-api.url" to "http://ssi-v1:8080"
)
}
} I use each profile once to verify the behaviour of injection I programmed into the application, such as: @QuarkusTest
@TestProfile(NoSsiIssuanceProfile::class)
open class NoSsiClientTest {
@Inject
lateinit var sut: Set<ApiVersion>
@Inject
lateinit var v1: Optional<SsiIssuanceV1HttpClient>
@Inject
lateinit var v2: Optional<SsiIssuanceV2HttpClient>
@Test
fun hasCorrectApiVersions() {
assertThat(sut, equalTo(setOf()))
}
@Test
fun hasNoV1Client() {
assertThat(v1.isEmpty, equalTo(true))
}
@Test
fun hasNoV2Client() {
assertThat(v2.isEmpty, equalTo(true))
}
} When I run all my tests, the JVM prematurely aborts the execution of all three test classes marked with This gives the impression that the complexity threshold is quite low before this bug leads to an |
Can you attach your sample application that leads to the OOME? |
I also have that problem on my project After checking, I noticed that each new Profile created a jump in memory use. I made a quick repo to show the problem https://github.com/Guillaume-Lebegue/quarkus_test_out_of_memory_testprofile When running the tests, the first test ended with ~500Mo of memory used, and the last test was at 1200Mo of memory used. |
I am facing the same issue with only two test profiles. All tests of the first profile are running as expected, but the startup of the second profile fails with an A new observation that I can add is that the issue only occurs since I added |
Another "me too", but I recently started migrating from 3.2.x to 3.8.4 (as the LTS is expiring on 3.2.x in July). I ran into a problem where
However, since doing this, the build with several of these tests fails with a OOM error. I have tried increasing the memory using These tests ran without issues when they were not using separate
EDIT: Also, removing |
I'm wondering if there is any traction on this issue. This is blocking our ability to upgrade to 3.8.4 because our test suite uses test profiles quite a lot and we haven't been able to get any alternatives working (see previous comment from billapepper). We are currently on the previous LTS version (3.2.x) which is expiring soon yet are blocked on upgrading to the 3.8.x LTS release. |
Describe the bug
Using multiple TestProfiles results in OutOfMemoryError: Metaspace
It seems that running a @QuarkusTest with its own @\TestProfile is not cleaned up properly after the Test has finished, and all QuarkusClassLoaders used are permanently stored in MetaSpace.
Each Test adding its own ClassLoader to MetaSpace until the OutOfMemoryError occurs.
Increasing the MetaSpace for each @QuarkusTest with its own @\TestProfile is a limited workaround.
Edit: I think this might be related to #12498 since the Heap Space is also effected.
Edit2: Screenshot added
Expected behavior
The expected behavior would be, that you are not limited to any amount of @\TestProfil and that each @\TestProfile would not increase the amount of MetaSpace required.
Actual behavior
Each @QuarkusTest with its own @\TestProfile requires the MetaSpace increased.
How to Reproduce?
Ready to go repo:
https://github.com/xuckz/quarkus-quickstarts-classloader-leak-demo
xuckz/quarkus-quickstarts-classloader-leak-demo@ccfa144
I used the quarkus-quickstarts/hibernate-orm-panache-quickstart as showcase:
Output of
uname -a
orver
Linux xxx 5.4.0-167-generic #184-Ubuntu SMP Tue Oct 31 09:21:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "17.0.9" 2023-10-17 OpenJDK Runtime Environment (build 17.0.9+9-Ubuntu-120.04) OpenJDK 64-Bit Server VM (build 17.0.9+9-Ubuntu-120.04, mixed mode, sharing)
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.6.3 Maven home: /usr/share/maven Java version: 17.0.9, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.4.0-167-generic", arch: "amd64", family: "unix"
Additional information
No response
The text was updated successfully, but these errors were encountered: