You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the JBehave feature of running tests concurrently fails under certain circumstances while writing the Thucydides report with the following exception:
[WARNING] Failed to run story stories/booking/Unlock.story
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.jbehave.core.reporters.ConcurrentStoryReporter$DelayedMethod.invoke(ConcurrentStoryReporter.java:356)
at org.jbehave.core.reporters.ConcurrentStoryReporter.invokeDelayed(ConcurrentStoryReporter.java:335)
at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:230)
at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:181)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:262)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:229)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jbehave.core.reporters.ConcurrentStoryReporter$DelayedMethod.invoke(ConcurrentStoryReporter.java:352)
... 10 more
Caused by: java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:102)
at java.util.Stack.pop(Stack.java:84)
at net.thucydides.jbehave.ThucydidesReporter.afterScenario(ThucydidesReporter.java:532)
at org.jbehave.core.reporters.DelegatingStoryReporter.afterScenario(DelegatingStoryReporter.java:43)
... 15 more
It is difficult to reproduce because it does not happen on any computer. In our case only to occurs when at least on scenario of a story is failing and multiple stories are used. Even than, it does not happen on every host - because a race condition seems to be involved, but it can be validated by setting some break points. It seems that net.thucydides.jbehave.ThucydidesReporter.activeScenarios is responsible for the failure, which is accessed concurrently by multiple threads.
We have tried out a fix where activeScenarios is accessed via a thread local variable which worked fine on our machines.
Best regards
Tronje
The text was updated successfully, but these errors were encountered:
Using the JBehave feature of running tests concurrently fails under certain circumstances while writing the Thucydides report with the following exception:
[WARNING] Failed to run story stories/booking/Unlock.story
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.jbehave.core.reporters.ConcurrentStoryReporter$DelayedMethod.invoke(ConcurrentStoryReporter.java:356)
at org.jbehave.core.reporters.ConcurrentStoryReporter.invokeDelayed(ConcurrentStoryReporter.java:335)
at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:230)
at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:181)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:262)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:229)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jbehave.core.reporters.ConcurrentStoryReporter$DelayedMethod.invoke(ConcurrentStoryReporter.java:352)
... 10 more
Caused by: java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:102)
at java.util.Stack.pop(Stack.java:84)
at net.thucydides.jbehave.ThucydidesReporter.afterScenario(ThucydidesReporter.java:532)
at org.jbehave.core.reporters.DelegatingStoryReporter.afterScenario(DelegatingStoryReporter.java:43)
... 15 more
It is difficult to reproduce because it does not happen on any computer. In our case only to occurs when at least on scenario of a story is failing and multiple stories are used. Even than, it does not happen on every host - because a race condition seems to be involved, but it can be validated by setting some break points. It seems that net.thucydides.jbehave.ThucydidesReporter.activeScenarios is responsible for the failure, which is accessed concurrently by multiple threads.
We have tried out a fix where activeScenarios is accessed via a thread local variable which worked fine on our machines.
Best regards
Tronje
The text was updated successfully, but these errors were encountered: