ResourceManager initialization is not thread-safe
-------------------------------------------------

                 Key: UIMA-1248
                 URL: https://issues.apache.org/jira/browse/UIMA-1248
             Project: UIMA
          Issue Type: Bug
          Components: Core Java Framework
    Affects Versions: 2.2.2
            Reporter: Adam Lally
            Assignee: Adam Lally
            Priority: Minor


If multiple threads concurrently call UIMAFramework.produceAnalysisEngine and 
pass the same instance of ResourceManager as an argument, you can get 
intermittent exceptions in the ResourceManager such as:
java.lang.ArrayIndexOutOfBoundsException
  at java.lang.System.arraycopy(Native Method)
  at java.util.ArrayList.ensureCapacity(ArrayList.java:170)
  at java.util.ArrayList.add(ArrayList.java:351)
  at 
org.apache.uima.resource.impl.CasManager_impl.addMetaData(CasManager_impl.java:82)
  at 
org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.initialize(AnalysisEngineImplBase.java:115)
  at 
org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initialize(AggregateAnalysisEngine_impl.java:126)

The workaround is to synchronize the calls to 
UIMAFramework.produceAnalysisEngine.   However, this is suboptimal if annotator 
initialization is expensive and you want it to be run in parallel on multiple 
cores.  We should consider adding synchronization to the ResourceManager (and 
the classes it delegates to such as CasManager) to allow this to work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to