[
https://issues.apache.org/jira/browse/UIMA-5597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16187996#comment-16187996
]
Marshall Schor commented on UIMA-5597:
--------------------------------------
I think I found the issue. I'd like to confirm a use case that I think uimaFIT
is using, which was not being supported.
In the current code, the sequence of operations for type system committing with
associated JCas class loaders is assumed to be:
# Type System A committed with classloader C_A ( class loaders from the
Resource Manager's extension class loader)
# When running a pipeline, the framework makes an (what I now think is
incorrect) assumption that it is being run with the same UIMA extension
classloader C_A, and any switch of a class loader within the pipeline is due to
a Pear
In uimaFIT's usage, it seems it is required to support running a pipeline with
a UIMA extension class loader which is a child of the one the type system was
committed with.
I can add this functionality, if that is what is needed. If uimaFIT is doing
something somewhat different, it would be good to know the details so the right
fix can be done.
> 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.
> {noformat}
> java.lang.IllegalStateException:
> org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator
> processing failed.
> at org.apache.uima.fit.pipeline.JCasIterator.next(JCasIterator.java:163)
> at org.apache.uima.fit.pipeline.JCasIterator.next(JCasIterator.java:1)
> at
> de.tudarmstadt.ukp.dkpro.core.testing.AssertAnnotations.assertTransformedText(AssertAnnotations.java:897)
> at
> de.tudarmstadt.ukp.dkpro.core.textnormalizer.transformation.RegexBasedTokenTransformerTest.test(RegexBasedTokenTransformerTest.java:45)
> ...
> Caused by: org.apache.uima.analysis_engine.AnalysisEngineProcessException:
> Annotator processing failed.
> at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:395)
> at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:297)
> at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:570)
> at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:412)
> at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:344)
> at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:271)
> at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:269)
> at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:284)
> at org.apache.uima.fit.pipeline.JCasIterator.next(JCasIterator.java:142)
> ... 26 more
> Caused by: java.lang.NullPointerException
> at
> org.apache.uima.cas.impl.CASImpl.createFsFromGenerator(CASImpl.java:1168)
> at
> org.apache.uima.cas.impl.CASImpl.createFSAnnotCheck(CASImpl.java:1124)
> at org.apache.uima.cas.impl.CASImpl.createFS(CASImpl.java:1105)
> at org.apache.uima.cas.impl.CASImpl.createAnnotation(CASImpl.java:3919)
> at
> org.apache.uima.cas.impl.CASImpl.createDocumentAnnotationNoRemoveNoIndex(CASImpl.java:4001)
> at
> org.apache.uima.cas.impl.CASImpl.createDocumentAnnotationNoRemove(CASImpl.java:3994)
> at
> org.apache.uima.cas.impl.CASImpl.getDocumentAnnotation(CASImpl.java:4061)
> at
> org.apache.uima.cas.impl.CASImpl.setDocumentLanguage(CASImpl.java:4202)
> at
> org.apache.uima.jcas.impl.JCasImpl.setDocumentLanguage(JCasImpl.java:825)
> at
> de.tudarmstadt.ukp.dkpro.core.api.transform.JCasTransformer_ImplBase.beforeProcess(JCasTransformer_ImplBase.java:81)
> at
> de.tudarmstadt.ukp.dkpro.core.api.transform.JCasTransformerChangeBased_ImplBase.beforeProcess(JCasTransformerChangeBased_ImplBase.java:57)
> at
> de.tudarmstadt.ukp.dkpro.core.api.transform.JCasTransformer_ImplBase.process(JCasTransformer_ImplBase.java:127)
> at
> org.apache.uima.analysis_component.JCasMultiplier_ImplBase.process(JCasMultiplier_ImplBase.java:58)
> at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:379)
> ... 34 more
> {noformat}
> 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)