You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Marshall Schor (JIRA)" <de...@uima.apache.org> on 2011/03/29 23:55:05 UTC

[jira] [Resolved] (UIMA-2078) Fix intermittent problem with CAS release while running scaled up AE in UIMA AS

     [ https://issues.apache.org/jira/browse/UIMA-2078?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marshall Schor resolved UIMA-2078.
----------------------------------

    Resolution: Fixed

The fix had many parts.

1) The upper level (root) UIMA context for the multiple instantiations is no longer shared (because it contains a ref to the CasManager impl instance, which is used for Cas Multipliers, and cannot be shared among instances).

2) Although the UIMA context is not shared, two objects it contains are: the ResourceManager and the ConfigurationManager.  This allows, for instance, parameter settings to be changed and reconfigure called, and it will change the param settings for all instances.

3) Parts of the CasManager and ResourceManger, called on multiple threads, were "synchronized".  

4) Several HashMaps used in these facilities were replaced with synchronized versions.  Concurrent Hash Maps were not used - the expected contention among these maps is likely very low.

5) Several process(...) method variants were missing (and defaulting to the base impl) in MultiprocessingAE class - this was causing a loss of integrity when running in multiple threads, when Cas Multipliers were used.

6) Several tests were added to the test suite, and were used to (a) verify that with the fixes, the tests (frequently) fail, and (b) verify that with the fixes, things work OK. (Tested on Windows and Mac)

5) 

> Fix intermittent problem with CAS release while running scaled up AE in UIMA AS 
> --------------------------------------------------------------------------------
>
>                 Key: UIMA-2078
>                 URL: https://issues.apache.org/jira/browse/UIMA-2078
>             Project: UIMA
>          Issue Type: Bug
>          Components: Async Scaleout, Core Java Framework
>            Reporter: Jerry Cwiklik
>            Assignee: Marshall Schor
>             Fix For: 2.3.2SDK
>
>
> While running extended tests on Mac, the testScaledSyncAggregateProcess() test failed with:
> org.apache.uima.analysis_engine.AnalysisEngineProcessException: CasManager.release(CAS) was called with a CAS that does not belong to this CasManager.\
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:701)\
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)\
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)\
> 	at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)\
> 	at org.apache.uima.aae.controller.PrimitiveAnalysisEngineController_impl.process(PrimitiveAnalysisEngineController_impl.java:514)\
> 	at org.apache.uima.aae.handler.HandlerBase.invokeProcess(HandlerBase.java:121)\
> 	at org.apache.uima.aae.handler.input.ProcessRequestHandler_impl.handleProcessRequestFromRemoteClient(ProcessRequestHandler_impl.java:474)\
> 	at org.apache.uima.aae.handler.input.ProcessRequestHandler_impl.handle(ProcessRequestHandler_impl.java:952)\
> 	at org.apache.uima.aae.handler.input.MetadataRequestHandler_impl.handle(MetadataRequestHandler_impl.java:78)\
> 	at org.apache.uima.adapter.jms.activemq.JmsInputChannel.onMessage(JmsInputChannel.java:702)\
> 	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:535)\
> 	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:495)\
> 	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)\
> 	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)\
> 	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)\
> 	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1056)\
> 	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:952)\
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)\
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)\
> 	at org.apache.uima.aae.UimaAsThreadFactory$1.run(UimaAsThreadFactory.java:106)\
> 	at java.lang.Thread.run(Thread.java:680)\
> Caused by: org.apache.uima.UIMARuntimeException: CasManager.release(CAS) was called with a CAS that does not belong to this CasManager.\
> 	at org.apache.uima.resource.impl.CasManager_impl.releaseCas(CasManager_impl.java:131)\
> 	at org.apache.uima.cas.AbstractCas_ImplBase.release(AbstractCas_ImplBase.java:35)\
> 	at org.apache.uima.cas.impl.CASImpl.release(CASImpl.java:3604)\
> 	at org.apache.uima.cas.impl.CASImpl.release(CASImpl.java:3602)\
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:689)\
> The above test deploys 5 instances of synchronous aggregate containing a CM and a NoOp Annotator. The CM generates 1 CAS for each input CAS. Total of 5 CASes are sent to the service for processing. Some of the CASes are processed and returned back to the client. I am not totally sure what the problem is at this time. It seems like the ASB is trying to release a child CAS when the above exception occurs. All instances of sync aggregates share Resource Manager containing common CasManager. Unable to reproduce this problem on Linux, Windows or Mac. 
> Further diagnosis points toward an issue with the UIMA Java SDK, for use cases where multiple instances of an aggregate (containing a Cas Multiplier) are created and run using a shared common UIMA Context / Resource Manager.  Several parts of the Resource Manager are not thread safe.  
> Figure out where things like getEmptyCas need to be synchronized.
> Come up with a better test case (that isn't so intermittent).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira