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

RequirementsTagProvider - Failed to load requirements: null java.lang.StackOverflowError #2030

Closed
grtangs opened this issue Apr 17, 2020 · 28 comments

Comments

@grtangs
Copy link

grtangs commented Apr 17, 2020

Facing this issue in serenity core 2.0.67 with below error, as report generation fails for 2244 requirements and below errors comes in infinite loop

net.thucydides.core.requirements.RequirementsTagProvider - Failed to load requirements: null
java.lang.StackOverflowError
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)

@wakaleo
Copy link
Member

wakaleo commented Apr 17, 2020

Have you tried with 2.2.1?

@grtangs
Copy link
Author

grtangs commented Apr 17, 2020

I am going to try it with 2.2.1, was this known issue in 2.0.67 and fixed in 2.2.x ?

@wakaleo
Copy link
Member

wakaleo commented Apr 17, 2020

I have never come across this issue but it very hard to trouble shoot older versions

@grtangs
Copy link
Author

grtangs commented Apr 17, 2020

I have reproduced this issue in 2.2.1, After running 2244 test cases, when it tries to generate reports below error is coming.

below is the stack trace, could you please guide the fix ? Thank you !

[main] ERROR org.apache.maven.plugin.failsafe.IntegrationTestMojo - Tests run: 2244, Failures: 4, Errors: 0, Skipped: 0
[main] INFO org.apache.maven.plugin.failsafe.IntegrationTestMojo -
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- serenity-maven-

[main] WARNING net.thucydides.core.requirements.RequirementsTagProvider - Failed to load requirements: null
java.lang.StackOverflowError
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)

@grtangs
Copy link
Author

grtangs commented Apr 20, 2020

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/var/lib/jenkins/workspace/TR_co-automation_develop/%3F/.m2/repository/com/google/inject/guice/4.2.2/guice-4.2.2.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[main] INFO net.serenitybdd.maven.plugins.SerenityAggregatorMojo - current_project.base.dir: /var/lib/jenkins/workspace/TR_co-automation_develop
[main] INFO net.thucydides.core.reports.html.HtmlAggregateStoryReporter - Generating test results for 2204 tests
[main] INFO net.thucydides.core.requirements.reports.MultipleSourceRequirmentsOutcomeFactory - Loading requirements from tag providers :[net.thucydides.core.requirements.PackageRequirementsTagProvider@54b112f6, net.thucydides.core.requirements.FileSystemRequirementsTagProvider@5197cb1, net.thucydides.core.requirements.FileSystemRequirementsTagProvider@39428923]
[main] INFO net.thucydides.core.requirements.PackageRequirementsTagProvider - Loading requirements from package requirements at: com.tr_co.junit
[main] WARNING net.thucydides.core.requirements.RequirementsTagProvider - Failed to load requirements: null
java.lang.StackOverflowError
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)

@wakaleo
Copy link
Member

wakaleo commented Apr 22, 2020

There isn't enough information to work with here - can you run with -e -X or even better provide a sample project? Alternatively, you can open a support ticket so that I can look directly at your project.

@ForeverMonica
Copy link

Hi John,

I am also facing this similar issue in my project, I have approx 2500+ test cases (test java classes as well) in multiple suites.

Reproduced this issue in 2.2.x, I have observed that after running 2500+ test cases, when it tries to load the requirements (I dont know how it works, does it match 1 java class per requirement in serenity report?)
below error is coming-

below is the stack trace, ccan you please help debugging this issue?
Or how can I resolve this? or can it be resolved by reducing the number of test classes and putting the multiple Junit tests
in a single/few test classes(grouping test casses)

[main] ERROR org.apache.maven.plugin.failsafe.IntegrationTestMojo - Tests run: 2513, Failures: 6, Errors: 0, Skipped: 0
[main] INFO org.apache.maven.plugin.failsafe.IntegrationTestMojo -
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- serenity-maven-

[main] WARNING net.thucydides.core.requirements.RequirementsTagProvider - Failed to load requirements: null
java.lang.StackOverflowError
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)
at java.util.Collections$UnmodifiableCollection.isEmpty (Collections.java:1033)

Thanks!!

@wakaleo
Copy link
Member

wakaleo commented Apr 30, 2020

Can you provide a sample project to reproduce the issue? The Collections class is a JVM class, so it could be a JVM-related issue. The fastest approach would be for you to request a commercial support package so that I can look directly at your code.

@ForeverMonica
Copy link

ForeverMonica commented Apr 30, 2020

Below is my machine configuration -
Dual core 2.4 Ghz processor
8 GB RAM

My maven failsafe plugin configuration for memory
forkCount=4
reuseFork=true
argLine=-Xmx2048m -XX:MaxPermSize=512m -Xss16m

Can you tell us if this failsafe config is fine to execute 2500+ test java classes using 4 JVM forked processes?
Or how can we know how much memeory is required for serenity to execute the test classes?

As we know by default serenity runs 2 threads per CPU core.

Thanks!! Your help is much appreciated.

@wakaleo
Copy link
Member

wakaleo commented Apr 30, 2020

I would need to see the build run to know.

@ForeverMonica
Copy link

Unfortunately, that is in restricted environment where i cannot take out actual build logs.
But any pointers on above config(higher number of java classes) will be very valuable to try.

@wakaleo
Copy link
Member

wakaleo commented Apr 30, 2020

I would need to see the environment and project directly - does your company have a commercial support contract for Serenity BDD?

@grtangs
Copy link
Author

grtangs commented May 8, 2020

From your comments in another issue #1294
it looks like that it is causing the same issue again, can it be related??? because i m seeing same exceptions.

...-model/src/main/java/net/thucydides/core/requirements/FileSystemRequirementsTagProvider.java
}
return requirements;
return Collections.unmodifiableList(requirements);
@wakaleo
wakaleo on Jul 4, 2018 Member
I would maybe just retain this line and see if this improves things.

@wakaleo
Copy link
Member

wakaleo commented May 8, 2020

Can you provide a sample project that reproduces the issue? I suspect it is JVM-related.

@grtangs
Copy link
Author

grtangs commented May 8, 2020

unfortunately not able to provide also this issue mostly comes in Jenkins with high configuration machine.

Any thought on when this error triggers ? I checked there is no duplicate feature/requirement/test package in project. also do you think it could because of -Xss (stacksize) param setting in failsafe plugin ?

@wakaleo
Copy link
Member

wakaleo commented May 8, 2020

You will need to dig into the code to try to isolate the root of the stack loop then. There really isn’t very much to go on from here.

@grtangs
Copy link
Author

grtangs commented May 8, 2020

Some more logging from RequirementsTagProvider stacktrace.

27758 [pool-2-thread-1] WARN net.thucydides.core.requirements.RequirementsTagProvider - Failed to load requirements: java.io.EOFException: End of input at line 1 column 2842625 path $[3].children[0].children[0].children
com.google.gson.JsonSyntaxException: java.io.EOFException: End of input at line 1 column 2842625 path $[3].children[0].children[0].children
at com.google.gson.Gson.fromJson(Gson.java:942)
at com.google.gson.Gson.fromJson(Gson.java:897)
at net.thucydides.core.requirements.FileSystemRequirementsStore.read(FileSystemRequirementsStore.java:42)
at net.thucydides.core.requirements.PackageRequirementsTagProvider.reloadedRequirements(PackageRequirementsTagProvider.java:104)
at net.thucydides.core.requirements.PackageRequirementsTagProvider.fetchRequirements(PackageRequirementsTagProvider.java:98)
at net.thucydides.core.requirements.PackageRequirementsTagProvider.getRequirements(PackageRequirementsTagProvider.java:89)
at net.thucydides.core.requirements.RequirementsProvided.by(RequirementsProvided.java:15)
at net.thucydides.core.requirements.MultiSourceRequirementsService.getRequirements(MultiSourceRequirementsService.java:40)
at net.thucydides.core.requirements.BaseRequirementsService.getRequirementTypes(BaseRequirementsService.java:197)
at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.addTestOutcomeToContext(HtmlAcceptanceTestReporter.java:163)
at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.generateReportFor(HtmlAcceptanceTestReporter.java:107)
at net.thucydides.core.reports.ReportService.generateReportFor(ReportService.java:239)
at net.thucydides.core.reports.ReportService.lambda$generateReportsFor$0(ReportService.java:177)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.EOFException: End of input at line 1 column 2842625 path $[3].children[0].children[0].children
at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1397)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:483)
at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:415)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:216)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:63)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:63)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:63)
at com.google.gson.Gson.fromJson(Gson.java:932)
... 17 more

@ForeverMonica
Copy link

Hi John,

I am also experiencing the above issue.

During this i have observed one thing that, when the tests are being executed, requirements are loaded in file \target\site\serenity\requirements\com.projectname.junit-package-requirements.json,
but as soon as we get the error- net.thucydides.core.requirements.RequirementsTagProvider - Failed to load requirements, the contents from the file com.projectname.junit-package-requirements.json, are deleted. This is tested on version 2.2.4.

Any idea why is this happening?

Thanks!!

@wakaleo
Copy link
Member

wakaleo commented May 9, 2020

Can you provide a sample project to reproduce the issue?

@ssmuthukumaran
Copy link

Faced this error while having an empty feature file.
After removing that file, everything was back to normal.

@Bhala1987
Copy link

I'm facing this issue too:
I wouldn't be bothered if this is taking very less time but the beautiful part is that these logs for every tag/scenario are taking much longer than the test scenario execution duration (say for example, test run duration: 6 minutes whereas these logs duration: 8 minutes, hence totally its taking 14 minutes instead of just 6-7 minutes))
Oct 26, 2020 8:08:01 AM net.thucydides.core.model.TestOutcome getTagsUsingTagProviders SEVERE: Tag provider net.thucydides.core.requirements.FileSystemRequirementsTagProvider@1efce9e failure java.lang.NullPointerException at net.thucydides.core.requirements.model.cucumber.CucumberParser.loadCucumberFeatures(CucumberParser.java:106) at net.thucydides.core.requirements.model.cucumber.CucumberParser.loadFeature(CucumberParser.java:72) at net.thucydides.core.requirements.model.cucumber.CucumberParser.loadFeatureNarrative(CucumberParser.java:136) at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.loadFromFeatureFile(FileSystemRequirementsTagProvider.java:624) at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.readRequirementsFromStoryOrFeatureFile(FileSystemRequirementsTagProvider.java:573) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.capabilitiesAndStoriesIn(FileSystemRequirementsTagProvider.java:197) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.getRequirements(FileSystemRequirementsTagProvider.java:179) at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.requirementWithMatchingFeatureFile(FileSystemRequirementsTagProvider.java:254) at net.thucydides.core.requirements.FileSystemRequirementsTagProvider.getTagsFor(FileSystemRequirementsTagProvider.java:226) at net.thucydides.core.model.TestOutcome.getTagsUsingTagProviders(TestOutcome.java:1877) at net.thucydides.core.model.TestOutcome.getTags(TestOutcome.java:1854) at net.thucydides.core.model.TestOutcome.addTags(TestOutcome.java:1907) at net.thucydides.core.steps.StepEventBus.addTagsToCurrentTest(StepEventBus.java:645) at io.cucumber.core.plugin.SerenityReporter.startScenario(SerenityReporter.java:579) at io.cucumber.core.plugin.SerenityReporter.startOfScenarioLifeCycle(SerenityReporter.java:569) at io.cucumber.core.plugin.SerenityReporter.handleTestCaseStarted(SerenityReporter.java:242) at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:45) at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:9) at io.cucumber.core.runtime.ThreadLocalRunnerSupplier$SynchronizedEventBus.send(ThreadLocalRunnerSupplier.java:100) at io.cucumber.core.runtime.ThreadLocalRunnerSupplier$LocalEventBus.send(ThreadLocalRunnerSupplier.java:68) at io.cucumber.core.runner.TestCase.run(TestCase.java:43) at io.cucumber.core.runner.Runner.runPickle(Runner.java:66) at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:149) at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:83) at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:24) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:227) at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:54) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at io.cucumber.junit.CucumberSerenityRunner$RunCucumber.evaluate(CucumberSerenityRunner.java:254) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:377) at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:138) at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451)

@wakaleo
Copy link
Member

wakaleo commented Oct 26, 2020

Can you provide a sample project? Also, what version are you using?

@Bhala1987
Copy link

Thanks, @globalworming , as discussed today over calendly (Google Meet), I have upgraded the serenity version from 2.2.0 to 2.3.12 and also the cucumber5 to cucumber6, the above-reported issue is gone now, and the whole execution time is drastically reduced.
[WARNING] Failed to load requirements

@Rangiferus
Copy link

I'm currently using Serenity 3.1.15 and have this problem too.

@wakaleo
Copy link
Member

wakaleo commented Jan 19, 2022

Can you provide a sample project that reproduces the error?

@Rangiferus
Copy link

I would have to prepare something, I cannot share what I'm working on...

@wakaleo
Copy link
Member

wakaleo commented Feb 12, 2022

Possibly fixed in 3.2.0

@wakaleo wakaleo closed this as completed Feb 12, 2022
@brkozz
Copy link

brkozz commented Feb 15, 2022

I had the same problem with the WARN and I updated to version 3.2.0 and it was solved, thanks

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

No branches or pull requests

7 participants