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

Getting out of memory error while running test in parallel #3205

Closed
bachhavdipak opened this issue Mar 24, 2023 · 9 comments · Fixed by #3206
Closed

Getting out of memory error while running test in parallel #3205

bachhavdipak opened this issue Mar 24, 2023 · 9 comments · Fixed by #3206

Comments

@bachhavdipak
Copy link

Getting out of memory error while running test in parallel . I am using below configuration along with annotation**@execution(SAME_THREAD)** in the class.

junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.mode.default = same_thread
junit.jupiter.execution.parallel.mode.classes.default = same_thread
junit.jupiter.execution.parallel.config.strategy = dynamic

Error log:


                  2023-03-24T10:08:17.6764760Z UnknownClass.JUnit Jupiter > UnknownClass.executionError FAILED
2023-03-24T10:08:17.6765471Z     org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to execute tests
2023-03-24T10:08:17.6765805Z         at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:113)
2023-03-24T10:08:17.6766208Z         at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
2023-03-24T10:08:17.6766499Z         at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
2023-03-24T10:08:17.6766817Z         at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
2023-03-24T10:08:17.6767143Z         at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
2023-03-24T10:08:17.6767424Z         at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
2023-03-24T10:08:17.6767662Z         at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
2023-03-24T10:08:17.6767942Z         at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
2023-03-24T10:08:17.6768226Z         at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
2023-03-24T10:08:17.6768582Z         at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
2023-03-24T10:08:17.6768988Z         at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
2023-03-24T10:08:17.6769704Z         at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
2023-03-24T10:08:17.6770117Z         at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)
2023-03-24T10:08:17.6770370Z         at java.base@11.0.18/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2023-03-24T10:08:17.6770603Z         at java.base@11.0.18/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2023-03-24T10:08:17.6770888Z         at java.base@11.0.18/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2023-03-24T10:08:17.6771124Z         at java.base@11.0.18/java.lang.reflect.Method.invoke(Method.java:566)
2023-03-24T10:08:17.6771362Z         at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
2023-03-24T10:08:17.6771603Z         at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
2023-03-24T10:08:17.6771874Z         at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
2023-03-24T10:08:17.6772158Z         at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
2023-03-24T10:08:17.6772393Z         at com.sun.proxy.$Proxy2.stop(Unknown Source)
2023-03-24T10:08:17.6772586Z         at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
2023-03-24T10:08:17.6772859Z         at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
2023-03-24T10:08:17.6773121Z         at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
2023-03-24T10:08:17.6773362Z         at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
2023-03-24T10:08:17.6773632Z         at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
2023-03-24T10:08:17.6773929Z         at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
2023-03-24T10:08:17.6774260Z         at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
2023-03-24T10:08:17.6774552Z         at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
2023-03-24T10:08:17.6774808Z         at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
2023-03-24T10:08:17.6774921Z 
2023-03-24T10:08:17.6775024Z         Caused by:
2023-03-24T10:08:17.6775303Z         org.junit.platform.commons.JUnitException: Error executing tests for engine junit-jupiter
2023-03-24T10:08:17.6775540Z             at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:57)
2023-03-24T10:08:17.6775832Z             at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
2023-03-24T10:08:17.6776020Z             ... 30 more
2023-03-24T10:08:17.6776077Z 
2023-03-24T10:08:17.6776165Z             Caused by:
2023-03-24T10:08:17.6776302Z             java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError
2023-03-24T10:08:17.6776510Z                 at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
2023-03-24T10:08:17.6776761Z                 at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
2023-03-24T10:08:17.6776965Z                 ... 31 more
2023-03-24T10:08:17.6777009Z 
2023-03-24T10:08:17.6777095Z                 Caused by:
2023-03-24T10:08:17.6777277Z                 java.lang.OutOfMemoryError
2023-03-24T10:08:17.6777444Z                     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
2023-03-24T10:08:17.6777755Z                     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
2023-03-24T10:08:17.6778043Z                     at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
2023-03-24T10:08:17.6778312Z                     at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
2023-03-24T10:08:17.6778536Z                     at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
2023-03-24T10:08:17.6778716Z                     ... 33 more
2023-03-24T10:08:17.6778759Z 
2023-03-24T10:08:17.6778847Z                     Caused by:
2023-03-24T10:08:17.6778980Z                     java.lang.OutOfMemoryError: Java heap space
2023-03-24T10:08:17.6779144Z                         at java.base/java.util.HashMap.newNode(HashMap.java:1815)
2023-03-24T10:08:17.6779336Z                         at java.base/java.util.HashMap.putVal(HashMap.java:627)
2023-03-24T10:08:17.6779522Z                         at java.base/java.util.HashMap.putMapEntries(HashMap.java:511)
2023-03-24T10:08:17.6779717Z                         at java.base/java.util.HashMap.<init>(HashMap.java:486)
2023-03-24T10:08:17.6779945Z                         at net.thucydides.core.environment.SystemEnvironmentVariables.copy(SystemEnvironmentVariables.java:45)
2023-03-24T10:08:17.6780243Z                         at net.thucydides.core.environment.SystemEnvironmentVariables.currentEnvironmentVariables(SystemEnvironmentVariables.java:62)
2023-03-24T10:08:17.6780564Z                         at net.serenitybdd.core.environment.ConfiguredEnvironment.getEnvironmentVariables(ConfiguredEnvironment.java:12)
2023-03-24T10:08:17.6780854Z                         at net.thucydides.core.annotations.locators.SmartAjaxElementLocator.<init>(SmartAjaxElementLocator.java:87)
2023-03-24T10:08:17.6781155Z                         at net.thucydides.core.annotations.locators.SmartAjaxElementLocator.<init>(SmartAjaxElementLocator.java:49)
2023-03-24T10:08:17.6781453Z                         at net.thucydides.core.annotations.locators.SmartElementLocatorFactory.createLocator(SmartElementLocatorFactory.java:21)
2023-03-24T10:08:17.6781757Z                         at net.thucydides.core.annotations.locators.SmartFieldDecorator.decorate(SmartFieldDecorator.java:53)
2023-03-24T10:08:17.6782008Z                         at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:111)
2023-03-24T10:08:17.6782255Z                         at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:103)
2023-03-24T10:08:17.6782521Z                         at net.thucydides.core.annotations.locators.SmartElementProxyCreator.proxyElements(SmartElementProxyCreator.java:22)
2023-03-24T10:08:17.6782829Z                         at net.thucydides.core.webdriver.DefaultPageObjectInitialiser.apply(DefaultPageObjectInitialiser.java:20)
2023-03-24T10:08:17.6783080Z                         at net.serenitybdd.core.pages.PageObject.setDriver(PageObject.java:167)
2023-03-24T10:08:17.6783319Z                         at net.serenitybdd.core.pages.PageObject.setDriver(PageObject.java:171)
2023-03-24T10:08:17.6783578Z                         at net.thucydides.core.steps.PageObjectDependencyInjector.updatePageObject(PageObjectDependencyInjector.java:99)
2023-03-24T10:08:17.6783892Z                         at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:48)
2023-03-24T10:08:17.6784207Z                         at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:84)
2023-03-24T10:08:17.6784538Z                         at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:50)
2023-03-24T10:08:17.6784864Z                         at net.thucydides.core.steps.StepFactory.injectOtherDependenciesInto(StepFactory.java:206)
2023-03-24T10:08:17.6785183Z                         at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:196)
2023-03-24T10:08:17.6785440Z                         at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:177)
2023-03-24T10:08:17.6785703Z                         at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:124)
2023-03-24T10:08:17.6786007Z                         at net.thucydides.core.steps.IndividualInstancesByDefaultStepCreationStrategy.initiateStepsFor(IndividualInstancesByDefaultStepCreationStrategy.java:16)
2023-03-24T10:08:17.6786347Z                         at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:89)
2023-03-24T10:08:17.6786624Z                         at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:70)
2023-03-24T10:08:17.6787546Z                         at net.thucydides.core.steps.StepAnnotations.injectNestedScenarioStepsInto(StepAnnotations.java:62)
2023-03-24T10:08:17.6787842Z                         at net.thucydides.core.steps.StepFactory.instantiateAnyNestedStepLibrariesIn(StepFactory.java:405)
2023-03-24T10:08:17.6788122Z                         at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:194)
2023-03-24T10:08:17.6788379Z                         at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:177)

Context

  • Used versions (Jupiter/Vintage/Platform): 5.9.2
  • Build Tool/IDE: Gradle/Intellij
@marcphilipp
Copy link
Member

@bachhavdipak Have you looked at a heap dump?

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Mar 24, 2023

@marcphilipp seeing how this issue involves a webdriver and parallel execution I reckon this is a variant of the problems solved by #3044. The difference being that this is using the dynamic strategy instead of the fixed variant.

I didn't know the right solution at the time but adding a junit.jupiter.execution.parallel.config.dynamic.max-pool-size-factor property to limit the maximum pool size could solve this.

@bachhavdipak can you still reproduce this problem on Java 11 or higher with a fixed strategy while using these config settings?

junit.jupiter.execution.parallel.enabled=true
junit.jupiter.execution.parallel.config.strategy=fixed
junit.jupiter.execution.parallel.config.fixed.parallelism=2
junit.jupiter.execution.parallel.config.fixed.max-pool-size=2

If the problem persists with these settings on Java 11 and higher you will also have to file a bug report with Serenity at https://github.com/serenity-bdd/serenity-core.

@bachhavdipak
Copy link
Author

bachhavdipak commented Mar 24, 2023 via email

mpkorstanje added a commit to mpkorstanje/junit5 that referenced this issue Mar 24, 2023
This is a followup of junit-team#3044 for the `dynamic` strategy.

Fixes: junit-team#3205
@stale
Copy link

stale bot commented Apr 11, 2023

If you would like us to be able to process this issue, please provide the requested information. If the information is not provided within the next 3 weeks, we will be unable to proceed and this issue will be closed.

@marcphilipp
Copy link
Member

@bachhavdipak Have you tried the settings suggested by @mpkorstanje in #3205 (comment)?

@bachhavdipak
Copy link
Author

bachhavdipak commented Apr 12, 2023

No ,I cant update jdk version due to company policies and still using jdk 8.

@marcphilipp
Copy link
Member

@bachhavdipak From your stacktrace above it looked like you're already using JDK 11:

2023-03-24T10:08:17.6770370Z         at java.base@11.0.18/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Was that from a local experiment?

@bachhavdipak
Copy link
Author

bachhavdipak commented Apr 12, 2023

@marcphilipp : I am using java version "1.8.0_281" on my local and trying to execute test through azure pipeline and experitest cloud browser.
image

@marcphilipp
Copy link
Member

@bachhavdipak Do you have an explanation for why the initial stack trace you shared was generated by JDK 11.0.18?

marcphilipp pushed a commit that referenced this issue Apr 23, 2023
This is a followup of #3044 for the `dynamic` strategy.

Fixes #3205.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants