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

Memory Leaks when using QuarkusTestProfile #12498

Closed
dhenneke opened this issue Oct 3, 2020 · 8 comments · Fixed by #15399
Closed

Memory Leaks when using QuarkusTestProfile #12498

dhenneke opened this issue Oct 3, 2020 · 8 comments · Fixed by #15399
Labels
area/testing kind/bug Something isn't working
Milestone

Comments

@dhenneke
Copy link
Contributor

dhenneke commented Oct 3, 2020

Describe the bug

I have a project with something like 10 test classes that each use a different Test Profile. There seems to be some kind of memory leak where something is not cleaned up correctly when a quarkus application was stopped after each of these classes.I am not sure if I am doing anything wrong or uncommon, or whether is actually an error in Quarkus.

Expected behavior
I can run all tests.

Actual behavior
I run the tests but the memory usage is rising which eventually leads to OutOfMemoryErrors.

To Reproduce
I created a small example project where I reproduced my problem with 10 Test classes and a limited heap space of 64m. The VM only runs 2 tests and then crashes due to a lack of free heap space. When I limit to 128m it runs around 7 tests before it crashes.

See this repository that also contains a log output: https://github.com/dhenneke/test-profile-memory-leak

Log output as copied from the repository
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< org.acme:test-profile-memory-leak >------------------
[INFO] Building test-profile-memory-leak 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ test-profile-memory-leak ---
[INFO] Deleting /root/test-profile-memory-leak/target
[INFO]
[INFO] --- quarkus-maven-plugin:1.8.1.Final:generate-code (default) @ test-profile-memory-leak ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test-profile-memory-leak ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ test-profile-memory-leak ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /root/test-profile-memory-leak/target/classes
[INFO]
[INFO] --- quarkus-maven-plugin:1.8.1.Final:generate-code-tests (default) @ test-profile-memory-leak ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ test-profile-memory-leak ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /root/test-profile-memory-leak/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ test-profile-memory-leak ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 10 source files to /root/test-profile-memory-leak/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ test-profile-memory-leak ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.ExampleResourceTest9
2020-10-03 13:02:03,021 INFO  [io.quarkus] (main) Quarkus 1.8.1.Final on JVM started in 4.433s. Listening on: http://0.0.0.0:8081
2020-10-03 13:02:03,023 INFO  [io.quarkus] (main) Profile test activated.
2020-10-03 13:02:03,024 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.126 s - in org.acme.ExampleResourceTest9
[INFO] Running org.acme.ExampleResourceTest4
2020-10-03 13:02:06,876 INFO  [io.quarkus] (main) Quarkus stopped in 0.081s
2020-10-03 13:02:13,344 INFO  [io.quarkus] (main) Quarkus 1.8.1.Final on JVM started in 5.832s. Listening on: http://0.0.0.0:8081
2020-10-03 13:02:13,345 INFO  [io.quarkus] (main) Profile test activated.
2020-10-03 13:02:13,345 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.301 s - in org.acme.ExampleResourceTest4
[INFO] Running org.acme.ExampleResourceTest2
2020-10-03 13:02:18,192 INFO  [io.quarkus] (main) Quarkus stopped in 0.073s
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 15.375 s <<< FAILURE! - in org.acme.ExampleResourceTest2
[ERROR] org.acme.ExampleResourceTest2.testHelloEndpoint  Time elapsed: 0.003 s  <<< ERROR!
java.lang.RuntimeException:
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.steps.ConfigGenerationBuildStep#generateConfigClass threw an exception: java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
        at io.quarkus.gizmo.BytecodeCreatorImpl$Operation.doProcess(BytecodeCreatorImpl.java:1252)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeInteriorOperations(BytecodeCreatorImpl.java:1145)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeOperations(BytecodeCreatorImpl.java:1139)
        at io.quarkus.gizmo.MethodCreatorImpl.write(MethodCreatorImpl.java:103)
        at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:180)
        at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:203)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator$GenerateOperation.run(RunTimeConfigurationGenerator.java:767)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator.generate(RunTimeConfigurationGenerator.java:249)
        at io.quarkus.deployment.steps.ConfigGenerationBuildStep.generateConfigClass(ConfigGenerationBuildStep.java:62)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:936)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: java.lang.OutOfMemoryError: Java heap space
        at java.base/java.util.Arrays.copyOf(Arrays.java:3745)
        at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:172)
        at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:538)
        at java.base/java.lang.StringBuilder.append(StringBuilder.java:174)
        at io.quarkus.gizmo.BytecodeCreatorImpl$InvokeOperation.writeBytecode(BytecodeCreatorImpl.java:1349)
        at io.quarkus.gizmo.BytecodeCreatorImpl$Operation.doProcess(BytecodeCreatorImpl.java:1249)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeInteriorOperations(BytecodeCreatorImpl.java:1145)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeOperations(BytecodeCreatorImpl.java:1139)
        at io.quarkus.gizmo.MethodCreatorImpl.write(MethodCreatorImpl.java:103)
        at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:180)
        at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:203)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator$GenerateOperation.run(RunTimeConfigurationGenerator.java:767)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator.generate(RunTimeConfigurationGenerator.java:249)
        at io.quarkus.deployment.steps.ConfigGenerationBuildStep.generateConfigClass(ConfigGenerationBuildStep.java:62)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:936)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at io.quarkus.builder.BuildContext$$Lambda$1489/0x00000001005f8440.run(Unknown Source)
        ... 6 more

Caused by: java.lang.RuntimeException:
io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.steps.ConfigGenerationBuildStep#generateConfigClass threw an exception: java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
        at io.quarkus.gizmo.BytecodeCreatorImpl$Operation.doProcess(BytecodeCreatorImpl.java:1252)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeInteriorOperations(BytecodeCreatorImpl.java:1145)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeOperations(BytecodeCreatorImpl.java:1139)
        at io.quarkus.gizmo.MethodCreatorImpl.write(MethodCreatorImpl.java:103)
        at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:180)
        at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:203)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator$GenerateOperation.run(RunTimeConfigurationGenerator.java:767)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator.generate(RunTimeConfigurationGenerator.java:249)
        at io.quarkus.deployment.steps.ConfigGenerationBuildStep.generateConfigClass(ConfigGenerationBuildStep.java:62)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:936)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: java.lang.OutOfMemoryError: Java heap space
        at java.base/java.util.Arrays.copyOf(Arrays.java:3745)
        at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:172)
        at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:538)
        at java.base/java.lang.StringBuilder.append(StringBuilder.java:174)
        at io.quarkus.gizmo.BytecodeCreatorImpl$InvokeOperation.writeBytecode(BytecodeCreatorImpl.java:1349)
        at io.quarkus.gizmo.BytecodeCreatorImpl$Operation.doProcess(BytecodeCreatorImpl.java:1249)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeInteriorOperations(BytecodeCreatorImpl.java:1145)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeOperations(BytecodeCreatorImpl.java:1139)
        at io.quarkus.gizmo.MethodCreatorImpl.write(MethodCreatorImpl.java:103)
        at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:180)
        at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:203)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator$GenerateOperation.run(RunTimeConfigurationGenerator.java:767)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator.generate(RunTimeConfigurationGenerator.java:249)
        at io.quarkus.deployment.steps.ConfigGenerationBuildStep.generateConfigClass(ConfigGenerationBuildStep.java:62)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:936)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at io.quarkus.builder.BuildContext$$Lambda$1489/0x00000001005f8440.run(Unknown Source)
        ... 6 more

Caused by: io.quarkus.builder.BuildException:
Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.steps.ConfigGenerationBuildStep#generateConfigClass threw an exception: java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
        at io.quarkus.gizmo.BytecodeCreatorImpl$Operation.doProcess(BytecodeCreatorImpl.java:1252)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeInteriorOperations(BytecodeCreatorImpl.java:1145)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeOperations(BytecodeCreatorImpl.java:1139)
        at io.quarkus.gizmo.MethodCreatorImpl.write(MethodCreatorImpl.java:103)
        at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:180)
        at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:203)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator$GenerateOperation.run(RunTimeConfigurationGenerator.java:767)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator.generate(RunTimeConfigurationGenerator.java:249)
        at io.quarkus.deployment.steps.ConfigGenerationBuildStep.generateConfigClass(ConfigGenerationBuildStep.java:62)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:936)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: java.lang.OutOfMemoryError: Java heap space
        at java.base/java.util.Arrays.copyOf(Arrays.java:3745)
        at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:172)
        at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:538)
        at java.base/java.lang.StringBuilder.append(StringBuilder.java:174)
        at io.quarkus.gizmo.BytecodeCreatorImpl$InvokeOperation.writeBytecode(BytecodeCreatorImpl.java:1349)
        at io.quarkus.gizmo.BytecodeCreatorImpl$Operation.doProcess(BytecodeCreatorImpl.java:1249)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeInteriorOperations(BytecodeCreatorImpl.java:1145)
        at io.quarkus.gizmo.BytecodeCreatorImpl.writeOperations(BytecodeCreatorImpl.java:1139)
        at io.quarkus.gizmo.MethodCreatorImpl.write(MethodCreatorImpl.java:103)
        at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:180)
        at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:203)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator$GenerateOperation.run(RunTimeConfigurationGenerator.java:767)
        at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator.generate(RunTimeConfigurationGenerator.java:249)
        at io.quarkus.deployment.steps.ConfigGenerationBuildStep.generateConfigClass(ConfigGenerationBuildStep.java:62)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:936)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at io.quarkus.builder.BuildContext$$Lambda$1489/0x00000001005f8440.run(Unknown Source)
        ... 6 more

Caused by: java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
Caused by: java.lang.OutOfMemoryError: Java heap space

[INFO] Running org.acme.ExampleResourceTest7
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 14.305 s <<< FAILURE! - in org.acme.ExampleResourceTest7
[ERROR] org.acme.ExampleResourceTest7.testHelloEndpoint  Time elapsed: 0.168 s  <<< ERROR!
java.lang.RuntimeException:
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.index.ApplicationArchiveBuildStep#build threw an exception: java.lang.OutOfMemoryError: Java heap space
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.initCEN(ZipFileSystem.java:1099)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:130)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:136)
        at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:406)
        at io.quarkus.deployment.index.ApplicationArchiveBuildStep.addMarkerFilePaths(ApplicationArchiveBuildStep.java:211)
        at io.quarkus.deployment.index.ApplicationArchiveBuildStep.scanForOtherIndexes(ApplicationArchiveBuildStep.java:129)
        at io.quarkus.deployment.index.ApplicationArchiveBuildStep.build(ApplicationArchiveBuildStep.java:107)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:936)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at io.quarkus.builder.BuildContext$$Lambda$1657/0x0000000100afd440.run(Unknown Source)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)

Caused by: java.lang.RuntimeException:
io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.index.ApplicationArchiveBuildStep#build threw an exception: java.lang.OutOfMemoryError: Java heap space
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.initCEN(ZipFileSystem.java:1099)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:130)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:136)
        at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:406)
        at io.quarkus.deployment.index.ApplicationArchiveBuildStep.addMarkerFilePaths(ApplicationArchiveBuildStep.java:211)
        at io.quarkus.deployment.index.ApplicationArchiveBuildStep.scanForOtherIndexes(ApplicationArchiveBuildStep.java:129)
        at io.quarkus.deployment.index.ApplicationArchiveBuildStep.build(ApplicationArchiveBuildStep.java:107)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:936)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at io.quarkus.builder.BuildContext$$Lambda$1657/0x0000000100afd440.run(Unknown Source)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)

Caused by: io.quarkus.builder.BuildException:
Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.index.ApplicationArchiveBuildStep#build threw an exception: java.lang.OutOfMemoryError: Java heap space
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.initCEN(ZipFileSystem.java:1099)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:130)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:136)
        at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:406)
        at io.quarkus.deployment.index.ApplicationArchiveBuildStep.addMarkerFilePaths(ApplicationArchiveBuildStep.java:211)
        at io.quarkus.deployment.index.ApplicationArchiveBuildStep.scanForOtherIndexes(ApplicationArchiveBuildStep.java:129)
        at io.quarkus.deployment.index.ApplicationArchiveBuildStep.build(ApplicationArchiveBuildStep.java:107)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:936)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at io.quarkus.builder.BuildContext$$Lambda$1657/0x0000000100afd440.run(Unknown Source)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:834)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)

Caused by: java.lang.OutOfMemoryError: Java heap space

[INFO] Running org.acme.ExampleResourceTest10
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.483 s <<< FAILURE! - in org.acme.ExampleResourceTest10
[ERROR] org.acme.ExampleResourceTest10.testHelloEndpoint  Time elapsed: 0.005 s  <<< ERROR!
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
Caused by: java.lang.OutOfMemoryError: Java heap space

[INFO] Running org.acme.ExampleResourceTest8
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.085 s <<< FAILURE! - in org.acme.ExampleResourceTest8
[ERROR] org.acme.ExampleResourceTest8.testHelloEndpoint  Time elapsed: 0.003 s  <<< ERROR!
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
Caused by: java.lang.OutOfMemoryError: Java heap space

[INFO] Running org.acme.ExampleResourceTest3
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.313 s <<< FAILURE! - in org.acme.ExampleResourceTest3
[ERROR] org.acme.ExampleResourceTest3.testHelloEndpoint  Time elapsed: 0.004 s  <<< ERROR!
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
Caused by: java.lang.OutOfMemoryError: Java heap space

[INFO] Running org.acme.ExampleResourceTest6
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.188 s <<< FAILURE! - in org.acme.ExampleResourceTest6
[ERROR] org.acme.ExampleResourceTest6.testHelloEndpoint  Time elapsed: 0.005 s  <<< ERROR!
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
Caused by: java.lang.OutOfMemoryError: Java heap space

[INFO] Running org.acme.ExampleResourceTest5
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.064 s <<< FAILURE! - in org.acme.ExampleResourceTest5
[ERROR] org.acme.ExampleResourceTest5.testHelloEndpoint  Time elapsed: 0.009 s  <<< ERROR!
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
Caused by: java.lang.OutOfMemoryError: Java heap space

[INFO] Running org.acme.ExampleResourceTest1
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.905 s <<< FAILURE! - in org.acme.ExampleResourceTest1
[ERROR] org.acme.ExampleResourceTest1.testHelloEndpoint  Time elapsed: 0.149 s  <<< ERROR!
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
Caused by: java.lang.OutOfMemoryError: Java heap space

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   ExampleResourceTest1.testHelloEndpoint » Runtime java.lang.OutOfMemoryError: J...
[ERROR]   ExampleResourceTest10.testHelloEndpoint » Runtime java.lang.OutOfMemoryError: ...
[ERROR]   ExampleResourceTest2.testHelloEndpoint » Runtime java.lang.RuntimeException: i...
[ERROR]   ExampleResourceTest3.testHelloEndpoint » Runtime java.lang.OutOfMemoryError: J...
[ERROR]   ExampleResourceTest5.testHelloEndpoint » Runtime java.lang.OutOfMemoryError: J...
[ERROR]   ExampleResourceTest6.testHelloEndpoint » Runtime java.lang.OutOfMemoryError: J...
[ERROR]   ExampleResourceTest7.testHelloEndpoint » Runtime java.lang.RuntimeException: i...
[ERROR]   ExampleResourceTest8.testHelloEndpoint » Runtime java.lang.OutOfMemoryError: J...
[INFO]
[ERROR] Tests run: 10, Failures: 0, Errors: 8, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:30 min
[INFO] Finished at: 2020-10-03T13:03:12Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project test-profile-memory-leak: There are test failures.
[ERROR]
[ERROR] Please refer to /root/test-profile-memory-leak/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Environment (please complete the following information):
I got the problem on my Windows Machine but decided to startup a Ubuntu Cloud-VM to check it also on a unix-system.

  • Output of uname -a or ver: Linux ubuntu-s-1vcpu-1gb-fra1-01 5.4.0-45-generic #49-Ubuntu SMP Wed Aug 26 13:38:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version:
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)
  • GraalVM version (if different from Java):
  • Quarkus version or git rev: 1.8.1 + the latest master snapshot (*/quarkus-bom/999-SNAPSHOT/quarkus-bom-999-20201003.021434-455.pom)
  • Build tool (ie. output of mvnw --version or gradlew --version): Happens on both Maven and Gradle
@dhenneke dhenneke added the kind/bug Something isn't working label Oct 3, 2020
@mkouba
Copy link
Contributor

mkouba commented Oct 5, 2020

CC @stuartwdouglas

stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Oct 7, 2020
geoand added a commit to geoand/quarkus that referenced this issue Feb 17, 2021
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Mar 2, 2021
It appears that groovy is going some stuff with
soft references that prevent the ClassLoader being
collected.

Further work should be done at some point to figure
out what is wrong, but for now we can just make it
parent first.

Fixes quarkusio#12498
@quarkus-bot quarkus-bot bot added this to the 1.13 - master milestone Mar 2, 2021
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Apr 26, 2021
Also moves a misplaced fix for quarkusio#12498 to
the correct spot.

Fixes quarkusio#16762
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Apr 26, 2021
Also moves a misplaced fix for quarkusio#12498 to
the correct spot.

Fixes quarkusio#16762
Fixes quarkusio#16755
@fvaleri
Copy link

fvaleri commented Jun 16, 2021

What's the state of this issue? We are hitting the same with 1.13.1.Final, openjdk version 11.0.10. We are using two simple test profiles, each one changing a single property.

Build failure: Build failed due to errors
	[error]: Build step io.quarkus.deployment.steps.ReflectiveHierarchyStep#build threw an exception: java.lang.OutOfMemoryError: Java heap space

	[error]: Build step io.quarkus.deployment.steps.ConfigGenerationBuildStep#generateConfigClass threw an exception: java.lang.OutOfMemoryError: Java heap space
	at io.quarkus.gizmo.BytecodeCreatorImpl.<init>(BytecodeCreatorImpl.java:48)
	at io.quarkus.gizmo.BytecodeCreatorImpl.<init>(BytecodeCreatorImpl.java:106)
	at io.quarkus.gizmo.BytecodeCreatorImpl.ifValue(BytecodeCreatorImpl.java:1265)
	at io.quarkus.gizmo.BytecodeCreatorImpl.ifNonZero(BytecodeCreatorImpl.java:825)
	at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator$GenerateOperation.generateParserBody(RunTimeConfigurationGenerator.java:1213)
	at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator$GenerateOperation.generateParserBody(RunTimeConfigurationGenerator.java:1242)
	at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator$GenerateOperation.generateParserBody(RunTimeConfigurationGenerator.java:1221)
	at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator$GenerateOperation.generateParserBody(RunTimeConfigurationGenerator.java:1221)
	at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator$GenerateOperation.run(RunTimeConfigurationGenerator.java:462)
	at io.quarkus.deployment.configuration.RunTimeConfigurationGenerator.generate(RunTimeConfigurationGenerator.java:249)
	at io.quarkus.deployment.steps.ConfigGenerationBuildStep.generateConfigClass(ConfigGenerationBuildStep.java:63)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at io.quarkus.builder.BuildContext$$Lambda$2829/0x0000000801651040.run(Unknown Source)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

	[error]: Build step io.quarkiverse.operatorsdk.deployment.OperatorSDKProcessor#createConfigurationServiceAndOperator threw an exception: java.lang.OutOfMemoryError: Java heap space

@geoand
Copy link
Contributor

geoand commented Jun 16, 2021

Does that same error occur with 1.13.7.Final?

If so, can you please open a new issue and attach the project you are using to reproduce the problem?
Thanks

@saravana2906
Copy link

saravana2906 commented Apr 10, 2023

i'm also facing similar issue , i have below logs

While running test case separately there is no issue its running fine , but running as a whole all test cases , its failing at same test case
i have increased memory 4.5 gb in gradle properties , but every time , its failing with OOM

https://gist.github.com/saravana2906/bc76f162880507b6186ca5e56bdb5f91

Quarkus version using:
2.16.3.Final

@geoand
Copy link
Contributor

geoand commented Apr 10, 2023

@saravana2906 can you please attach a sample project that exhibits the problematic behavior?

@saravana2906
Copy link

saravana2906 commented Apr 10, 2023

@geoand i will try to separate the code and reproduce this issue . Is there anything we can find from logs.

@geoand
Copy link
Contributor

geoand commented Apr 10, 2023

Thanks

@gkozyryatskyy
Copy link

Having the same problem. Do you have any workaround for this? Do you still need a reproducer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants