Interestingly enough, I already read this part of the documentation and
I was releasing the CAS in my first implementation, but it didn't help.....
- If I release the CAS just after calling the sendCAS, it was not
actually processing the CAS (or at least the callback listener was never
called). The blocking situation is occuring... I have the following
logs :
"ERROR:org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngine_impl.:onMessage:NullPointerException"
- I tried to release the CAS in the callback listener, the blocking
situation was the same and I have the following warning log on release
"WARNING :org.apache.uima.util.CasPool : releaseCas: The system tried to
return a common analysis structure to the pool from which it was not
checked out. "
- I looked at the process method of
BaseUIMAAsynchronousEngineCommon_impl and saw the CAS are not released
there (see below) nor in the implementation of the test callback
implementation.....
do
{
if(!initialized || !running)
break;
try
{
if(!(hasNext = collectionReader.hasNext()))
break;
cas = getCAS();
collectionReader.getNext(cas);
sendCAS(cas);
}
catch(Exception e)
{
e.printStackTrace();
}
} while(true);
I am really confused.... Where should I release the CAS ?
Thanks
Pierre
Le 31/03/2010 15:52, Jaroslaw Cwiklik a écrit :
> You are not calling cas.release() when you are done with the CAS.
> Per UIMA AS documentation ("4.2 The UimaAsynchronousEngine Interface - CAS
> getCAS()"
>
> "...CAS getCAS(): Requests a new CAS instance from the CAS pool. This method
> blocks until a free instance of CAS is available in the CAS pool.
> Applications that
> use getCAS() need to call CAS.reset() before reusing the CAS, or
> CAS.release()
> to return it to the Cas pool."
>
> The release() places a CAS back into the pool so the subsequent call to
> getCAS()
> succeeds. An alternate strategy is to have a single CAS instance in the CAS
> pool
> call getCAS() to get that instance and enter a while loop. When done
> processing
> reply, call cas.reset() and do *not* call getCAS() again.
>
> JC
>
> On Tue, Mar 30, 2010 at 5:41 AM, pierre yahoo<ppujalon@yahoo.fr> wrote:
>
>
>> I'm trying to use UIMA-AS to scale a part of the process of our
>> application.
>> I have successfully deployed our process as asynchronous services but I
>> have tremendous issues with the client.
>>
>> I'm basically looping synchronously(one at a time) on the following code.
>> CAS cas = uimaEEEngine.getCAS();
>> JCas jcas;
>> try {
>> jcas = cas.getJCas();
>> } catch (CASException e) {
>> throw new ResourceProcessException(e);
>> }
>> fillCas(jcas);
>> uimaEEEngine.sendCAS(cas);
>>
>> When I run the application, the client works fine for a while and suddenly
>> gets stuck waiting on cas.getJCas()..
>> I have checked that the asynchronous service have processed all the
>> previous CAS. The service is still up and running as I can send requests
>> from an another client.
>> When I tracked down who locks the process, I can see that the semaphore on
>> CasQueueEntry is not released.
>> When I looked further, I noticed that the all process is basically lock
>> when the CasManager_Impl is calling CasPool.getCas(0) . The CasPool is then
>> waiting with no timeout for someone to notify it.
>>
>> I try to change the size of the client CasPool but it didn't really fix the
>> issue. Just pushing further the lock...
>>
>> Does anyone have ever experienced this? Am I doing something wrong ?
>>
>> Pierre
>>
>>
>
|