Richard Eckart de Castilho created UIMA-5597:
------------------------------------------------

             Summary: uv3: FsGenerators may end up all being null
                 Key: UIMA-5597
                 URL: https://issues.apache.org/jira/browse/UIMA-5597
             Project: UIMA
          Issue Type: Bug
          Components: Core Java Framework
    Affects Versions: 3.0.0SDK-beta
            Reporter: Richard Eckart de Castilho


There appears to be a problem with the initialization of the FS generators when 
many classloaders are involved. uimaFIT configures all component with dedicated 
resource managers and these are all configured with a parent classloader, 
causing many UimaClassLoaders to be around in uimaFIT-based setups.

Usually, this seems to work well in UIMA v2 and UIMA v3. However, presently CAS 
multipliers seem to be a problem in UIMA v3.

I tried to debug this to some degree based on a unit test in DKPro Core and 
ended up in the following code in 
`FSClassRegistry.getGeneratorsForClassLoader(...)`:

{noformat}
       // skip entering a generator in the result if
        //    in a pear setup, and this cl is not the cl that loaded the JCas 
class.
        //    See method comment for why.
        if (!isPear || jcci.isPearOverride(cl)) {
          r[ti.getCode()] = (FsGenerator3) jcci.generator;
        }   
{noformat}

In this particular unit test, the code is called 3 times. 

The first two times when the CAS that is to be passed to the pipeline 
components is created by the uimaFIT JCasIterator. These first two times appear 
ok - the feature generators array is filled.

{noformat}
1) cl := sun.misc.Launcher$AppClassLoader
   isPear := false
   jcci.isPearOverride(cl) := true

        FSClassRegistry.getGeneratorsForClassLoader(ClassLoader, boolean, 
TypeSystemImpl) line: 879     
        TypeSystemImpl.getGeneratorsForClassLoader(ClassLoader, boolean) line: 
2630     
        TypeSystemImpl.commit(ClassLoader) line: 1378   
        TypeSystemImpl.commit() line: 1313      
        TypeSystemImpl.<clinit>() line: 2484    
        CASFactory.createTypeSystem() line: 126 
        CASImpl.<init>(TypeSystemImpl, int) line: 885   
        CASImpl.<init>() line: 908      
        CASFactory.createCAS() line: 48 
        CasCreationUtils.doCreateCas(TypeSystem, TypeSystemDescription, 
TypePriorities, FsIndexDescription[], Properties, ResourceManager) line: 604    
        CasCreationUtils.createCas(Collection<MetaDataObject>, Properties, 
ResourceManager) line: 292   
        JCasIterator.<init>(CollectionReader, AnalysisEngine...) line: 90       
        JCasIterable.iterator() line: 79        
        JCasIterable.iterator() line: 1 
        AssertAnnotations.assertTransformedText(String, String, String, 
AnalysisEngineDescription...) line: 897 
        RegexBasedTokenTransformerTest.test() line: 45  
{noformat}

{noformat}
2) cl := org.apache.uima.internal.util.UIMAClassLoader@50378a4 
   isPear := false
   jcci.isPearOverride(cl) := false

        FSClassRegistry.getGeneratorsForClassLoader(ClassLoader, boolean, 
TypeSystemImpl) line: 879     
        TypeSystemImpl.getGeneratorsForClassLoader(ClassLoader, boolean) line: 
2630     
        TypeSystemImpl.commit(ClassLoader) line: 1378   
        CASImpl.commitTypeSystem() line: 1529   
        CasCreationUtils.doCreateCas(TypeSystem, TypeSystemDescription, 
TypePriorities, FsIndexDescription[], Properties, ResourceManager) line: 613    
        CasCreationUtils.createCas(Collection<MetaDataObject>, Properties, 
ResourceManager) line: 292   
        JCasIterator.<init>(CollectionReader, AnalysisEngine...) line: 90       
        JCasIterable.iterator() line: 79        
        JCasIterable.iterator() line: 1 
        AssertAnnotations.assertTransformedText(String, String, String, 
AnalysisEngineDescription...) line: 897 
        RegexBasedTokenTransformerTest.test() line: 45          
{noformat}

The third time in the FlowController. This time `isPear` is `true` causing the 
FS generators array to be all null. Mind, I'm not using PEARs, I only set the 
parent classloader for the resource managers, no custom classpath URLs.

{noformat}
3) cl = org.apache.uima.internal.util.UIMAClassLoader@4b2bac3f
   isPear := true
   jcci.isPearOverride(cl) := false

        FSClassRegistry.getGeneratorsForClassLoader(ClassLoader, boolean, 
TypeSystemImpl) line: 891     
        TypeSystemImpl.getGeneratorsForClassLoader(ClassLoader, boolean) line: 
2630     
        CASImpl$SharedViewData.switchClassLoader(ClassLoader) line: 724 
        CASImpl.switchClassLoaderLockCasCL(ClassLoader) line: 3568      
        FlowControllerContainer.computeFlow(CAS) line: 226      
        ASB_impl$AggregateCasIterator.<init>(ASB_impl, CAS) line: 406   
        ASB_impl.process(CAS) line: 344 
        AggregateAnalysisEngine_impl.processAndOutputNewCASes(CAS) line: 271    
        AggregateAnalysisEngine_impl(AnalysisEngineImplBase).process(CAS) line: 
269     
        AggregateAnalysisEngine_impl(AnalysisEngineImplBase).process(JCas) 
line: 284    
        JCasIterator.next() line: 142   
        JCasIterator.next() line: 1     
        AssertAnnotations.assertTransformedText(String, String, String, 
AnalysisEngineDescription...) line: 897 
        RegexBasedTokenTransformerTest.test() line: 45  
 {noformat}






--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to