JBehave
  1. JBehave
  2. JBEHAVE-1063

ConcurrentModificationException in CrossReference.outputFile()

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.x
    • Fix Version/s: 4.x
    • Component/s: Core
    • Labels:
    • Number of attachments :
      0

      Description

      When Tests are executed massivley multithreaded, from time to time a ConcurrentModificationException is thrown when JBehave tries to write a report-file.

      Trace:

      java.util.ConcurrentModificationException
      	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:926)
      	at java.util.HashMap$KeyIterator.next(HashMap.java:960)
      	at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:54)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convert(TreeMarshaller.java:70)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:229)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:208)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.<init>(AbstractReflectionConverter.java:171)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:116)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:72)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convert(TreeMarshaller.java:70)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      	at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
      	at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:55)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convert(TreeMarshaller.java:70)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:229)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:208)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.<init>(AbstractReflectionConverter.java:171)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:116)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:72)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convert(TreeMarshaller.java:70)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
      	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
      	at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
      	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
      	at com.thoughtworks.xstream.XStream.marshal(XStream.java:895)
      	at com.thoughtworks.xstream.XStream.marshal(XStream.java:884)
      	at com.thoughtworks.xstream.XStream.toXML(XStream.java:857)
      	at com.thoughtworks.xstream.XStream.toXML(XStream.java:844)
      	at org.jbehave.core.reporters.CrossReference.outputFile(CrossReference.java:150)
      	at org.jbehave.core.reporters.CrossReference.outputToFiles(CrossReference.java:123)
      	at org.jbehave.core.reporters.CrossReference$1.afterStory(CrossReference.java:234)
      	at org.jbehave.core.reporters.ConcurrentStoryReporter.afterStory(ConcurrentStoryReporter.java:121)
      	at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:324)
      	at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:219)
      	at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:180)
      	at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:229)
      	at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:201)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      

        Activity

        Hide
        Mauro Talevi added a comment -

        Which version are you using? Can you provide a sample project that reproduces this behaviour?

        Show
        Mauro Talevi added a comment - Which version are you using? Can you provide a sample project that reproduces this behaviour?
        Hide
        Rainer Frömming added a comment - - edited

        @Mauro: I am currently running 3.8, but I reproduced this Problem with all 3.x Versions i tried (3.69, 3.8, 3.9.x)

        I am sorry, I can not provide a Project easily, as it is company property, but I could provide snippets if you tell me what you need.

        As a follow up to this Problem, the Jenkins build fails because there are errors processing the result file. The Jbehave-Jenkins Plugin seems Buggy as well, as i cannot remove the check-flag from the "Stop and set the build to 'failed' status if there are errors when processing a result file"-Option (I can actually remove it, but the setting is not saved and is checked again next time i open the job).

        Show
        Rainer Frömming added a comment - - edited @Mauro: I am currently running 3.8, but I reproduced this Problem with all 3.x Versions i tried (3.69, 3.8, 3.9.x) I am sorry, I can not provide a Project easily, as it is company property, but I could provide snippets if you tell me what you need. As a follow up to this Problem, the Jenkins build fails because there are errors processing the result file. The Jbehave-Jenkins Plugin seems Buggy as well, as i cannot remove the check-flag from the "Stop and set the build to 'failed' status if there are errors when processing a result file"-Option (I can actually remove it, but the setting is not saved and is checked again next time i open the job).
        Rainer Frömming made changes -
        Field Original Value New Value
        Priority Critical [ 2 ] Major [ 3 ]
        Hide
        Rainer Frömming added a comment - - edited

        As a workaround I changed my code to write reports at the very end where no concurrency issues appear. Because of this I also changed the priority of this Issue from "Critical" to "Major":

        new CrossReference().withOutputAfterEachStory(true);
        

        to

        new CrossReference().withOutputAfterEachStory(false);
        
        Show
        Rainer Frömming added a comment - - edited As a workaround I changed my code to write reports at the very end where no concurrency issues appear. Because of this I also changed the priority of this Issue from "Critical" to "Major": new CrossReference().withOutputAfterEachStory( true ); to new CrossReference().withOutputAfterEachStory( false );

          People

          • Assignee:
            Unassigned
            Reporter:
            Rainer Frömming
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: