[ 
https://issues.apache.org/jira/browse/UIMA-4463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14586725#comment-14586725
 ] 

Marshall Schor commented on UIMA-4463:
--------------------------------------

I'm having some trouble in reproducing this.  
First, can you see if the part of the code which does
{code}
if (!copier.alreadyCopied(a)) {
  Annotation a2 = (Annotation) copier.copyFs(a);
  a2.addToIndexes();
}
{code}
ever does the copyFs and addToIndexes?  On my test try, the add to indexes 
fails, because the copyFs copies the annotation including its Sofa Feature 
Structure, which then fails the add to index test which requires the Annotation 
to be over the same view in which it is being indexed.  

> java.util.ConcurrentModificationException in iterate-and-copyFs() loop
> ----------------------------------------------------------------------
>
>                 Key: UIMA-4463
>                 URL: https://issues.apache.org/jira/browse/UIMA-4463
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.7.0SDK
>            Reporter: Petr Baudis
>
> My code, e.g.
>       
> https://github.com/brmson/yodaqa/blob/master/src/main/java/cz/brmlab/yodaqa/analysis/passextract/PassFilter.java#L67
> works fine with UIMA-2.6.0 but with UIMA-2.7.0 and its rewritten CasCopier it 
> crashes with
>        Caused by: java.util.ConcurrentModificationException
>                at 
> org.apache.uima.cas.impl.FSIndexRepositoryImpl$LeafPointerIterator.checkConcurrentModification(FSIndexRepositoryImpl.java:967)
>                at 
> org.apache.uima.cas.impl.FSIndexRepositoryImpl$LeafPointerIterator.ll_get(FSIndexRepositoryImpl.java:1002)
>                at 
> org.apache.uima.cas.impl.FSIndexRepositoryImpl$LeafPointerIterator.get(FSIndexRepositoryImpl.java:995)
>                at 
> org.apache.uima.cas.impl.FSIteratorWrapper.get(FSIteratorWrapper.java:53)
>                at 
> org.apache.uima.cas.impl.FSIteratorImplBase.next(FSIteratorImplBase.java:67)
>                at 
> org.apache.uima.cas.impl.FSIteratorImplBase.next(FSIteratorImplBase.java:33)
>                at 
> cz.brmlab.yodaqa.analysis.passextract.PassFilter.process(PassFilter.java:74)
>                at 
> org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
>                at
> +org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:385)
>                ... 26 more
> so it appears I cannot iterate a source view and simultaneously copyFs() from 
> it.  This is a regression, and also seems rather counterintuitive - copyFs 
> surely shouldn't modify the source view? Using the new 
> .withSnapshotIterator() feature helps to work-around this, but for JCasUtil 
> users this is not trivial to do at the moment (and then, it should be 
> documented precisely what the CasCopier semantics in this regard is)..



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to