You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Josep María Formentí Serra <jm...@aia.es> on 2017/06/06 09:03:01 UTC

UIMA Ruta thread safe

Hi all,

  We are building a web service using directly the RutaEngine, in the
inicialization the engine is built as:

UIMAFramework.produceAnalysisEngine(AnalysisEngineFactory

.createEngineDescription(createEngineDescription(RutaEngine.class,
                                            RutaEngine.PARAM_RULES,
rule.getRule().getConditions()))));

  And then we call method *process *passing the *JCas*.

  All is ok but when we receive concurrent requests, starts to appears many
exceptions like these:

Caused by: java.lang.IllegalArgumentException: Document is ambiguous, use
one of the following instead : uima.tcas.DocumentAnnotation
de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Document
    at
org.apache.uima.ruta.RutaEnvironment.getType(RutaEnvironment.java:459)
~[ruta-core-2.6.0.jar:2.6.0]

Caused by: java.lang.NullPointerException: null
    at java.util.ArrayList.addAll(ArrayList.java:577) ~[na:1.8.0_66]
    at
org.apache.uima.ruta.condition.ImplicitCondition.eval(ImplicitCondition.java:70)
~[ruta-core-2.6.0.jar:2.6.0]

  Is UIMA Ruta thread safe? we are doing something wrong?

Thanks in advance,
  JM

Re: UIMA Ruta thread safe

Posted by Peter Klügl <pe...@averbis.com>.
Hi,


Am 09.06.2017 um 14:47 schrieb Josep María Formentí Serra:
> Hi Peter,
>
>> Ok, so you have no script file for the rules executed in the analysis
>> engine but use the rules parameter, right? Did you import the type
>> system containing the type in the rule string?
> Yes, we use the rules parameter and do the import.
>
> Really we have a ruta engine for each "control rule", each engine use the
> rules parameter and each "control rule" starts with:
>
> PACKAGE com.aia.tas.uima.types;
> DECLARE ControlRuleDetection;

I am just trying to narrow down the problem :-)


So there is no separate type system defining ControlRuleDetection but
the type is defined in the rules that are applied.
The complete name of such a type would be
"com.aia.tas.uima.types.Anonymous.ControlRuleDetection" as types created
by declare follow always this pattern: package.Script.Type... so that
types with the same short name defined in different scripts in the same
package can be distinguished.
Besides that, the declare in the rules does not matter at all and does
not inject new types when the analysis engine processes the CAS. A type
system description needs to be created from the script/rules and needs
to be included in the CAS creation process.

My best guess is this:
You did not have this problem before probably because a type with the
short name "ControlRuleDetection" was available in the type system of
the CAS. Is there maybe a type in some type system mentioned in
types.txt? Now, only types imported or declared in the rules are known.
Thus, the rules assume the complete name mentioned above.

I would import the type system in the rules and remove the declare.


Best,

Peter


> Best,
>
>
>
> 2017-06-09 13:22 GMT+02:00 Peter Klügl <pe...@averbis.com>:
>
>> Hi,
>>
>>
>> Am 09.06.2017 um 11:52 schrieb Josep María Formentí Serra:
>>> Thanks Hugues, suggestion of JCasPool is very interesting, we have some
>>> doubts but I'll open another thread for that.
>>>
>>> Regarding our problem with concurrent requests, we tried to use
>>> stricImports but then appears another exception (but other exceptions can
>>> appears):
>>>
>>> Caused by: java.lang.RuntimeException: Type 'com.aia.tas.uima.types.
>>> Anonymous.ControlRuleDetection' not found
>>>
>>>                 at org.apache.uima.ruta.RutaEnvironment.
>> importDeclaredTypes(
>>> RutaEnvironment.java:310)
>>>
>>>
>>> We have the type 'com.aia.tas.uima.types.ControlRuleDetection' without
>>> Anonymous.
>> Ok, so you have no script file for the rules executed in the analysis
>> engine but use the rules parameter, right? Did you import the type
>> system containing the type in the rule string?
>>
>>
>> Best,
>>
>> Peter
>>
>>
>>> Temporaly we have a workaround, we did a wrapper of RutaEngine putting a
>>> synchronized in the process method, doing this all is working properly.
>>>
>>>
>>>
>>>
>>>
>>> 2017-06-06 15:49 GMT+02:00 Hugues de Mazancourt <hu...@mazancourt.com>:
>>>
>>>> Hi,
>>>>
>>>> From my experience, Ruta is actually thread-safe and use of «
>>>> strictImports » solves many of the type ambiguities between Ruta and
>> DKPro.
>>>> In a concurrent environment, you will certainly gain performance by
>> using
>>>> a JCasPool for creating your CASes
>>>>
>>>> Best,
>>>>
>>>>
>>>> — Hugues de Mazancourt
>>>>
>>>>
>>>>
>>>>> Le 6 juin 2017 à 15:13, Josep María Formentí Serra <jm...@aia.es>
>>>> a écrit :
>>>>> Thanks Peter,
>>>>>
>>>>>> Could it be that you create the CAS differently in your concurrent
>>>>>> setting? For example JCasFactory vs ae.newCAS()?
>>>>> CAS is created ever using JCasFactory, we revise if there are something
>>>>> wrong in the reader.
>>>>>
>>>>>> Anyways, this exception in this situation (using DKPro Core) is really
>>>>>> annoying. Did you try to activate strictImports?
>>>>> It's really annoying, we have a set of requests to test the web
>> service.
>>>> If
>>>>> we execute the set of test with one thread all is ok, no exception, but
>>>>> when we execute the same set with more than one thread, the exceptions
>>>>> appears.
>>>>>
>>>>>> If this does not help, do you have a minimal reproducible example?
>>>>> No, I haven't, I'll check the code and if I don't find the solution,
>> I'll
>>>>> try to prepare a minimal example to reproduce the problem
>>>>>
>>>>> 2017-06-06 11:46 GMT+02:00 Peter Klügl <pe...@averbis.com>:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>
>>>>>> UIMA Ruta should be threadsafe.
>>>>>>
>>>>>>
>>>>>> Could it be that you create the CAS differently in your concurrent
>>>>>> setting? For example JCasFactory vs ae.newCAS()?
>>>>>>
>>>>>> The exception indicates that Ruta cannot resolve the mention
>> "Document"
>>>>>> correctly since it is an alias of uima.tcas.DocumentAnnotation and the
>>>>>> short name of the DKPro type. This exception should also occur in a
>>>>>> non-concurrent setting.
>>>>>>
>>>>>> Anyways, this exception in this situation (using DKPro Core) is really
>>>>>> annoying. Did you try to activate strictImports?
>>>>>>
>>>>>>
>>>>>> If this does not help, do you have a minimal reproducible example?
>>>>>>
>>>>>>
>>>>>>
>>>>>> Best,
>>>>>>
>>>>>> Peter
>>>>>>
>>>>>>
>>>>>> Am 06.06.2017 um 11:03 schrieb Josep María Formentí Serra:
>>>>>>> Hi all,
>>>>>>>
>>>>>>>  We are building a web service using directly the RutaEngine, in the
>>>>>>> inicialization the engine is built as:
>>>>>>>
>>>>>>> UIMAFramework.produceAnalysisEngine(AnalysisEngineFactory
>>>>>>>
>>>>>>> .createEngineDescription(createEngineDescription(RutaEngine.class,
>>>>>>>                                            RutaEngine.PARAM_RULES,
>>>>>>> rule.getRule().getConditions()))));
>>>>>>>
>>>>>>>  And then we call method *process *passing the *JCas*.
>>>>>>>
>>>>>>>  All is ok but when we receive concurrent requests, starts to appears
>>>>>> many
>>>>>>> exceptions like these:
>>>>>>>
>>>>>>> Caused by: java.lang.IllegalArgumentException: Document is
>> ambiguous,
>>>>>> use
>>>>>>> one of the following instead : uima.tcas.DocumentAnnotation
>>>>>>> de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Document
>>>>>>>    at
>>>>>>> org.apache.uima.ruta.RutaEnvironment.getType(
>> RutaEnvironment.java:459)
>>>>>>> ~[ruta-core-2.6.0.jar:2.6.0]
>>>>>>>
>>>>>>> Caused by: java.lang.NullPointerException: null
>>>>>>>    at java.util.ArrayList.addAll(ArrayList.java:577) ~[na:1.8.0_66]
>>>>>>>    at
>>>>>>> org.apache.uima.ruta.condition.ImplicitCondition.eval(
>>>>>> ImplicitCondition.java:70)
>>>>>>> ~[ruta-core-2.6.0.jar:2.6.0]
>>>>>>>
>>>>>>>  Is UIMA Ruta thread safe? we are doing something wrong?
>>>>>>>
>>>>>>> Thanks in advance,
>>>>>>>  JM
>>>>>>>
>>>>> --
>>>>> -------------------------------------------------------------------
>> ---
>>>> --
>>>>> - - -
>>>>> *Grupo AIA* - *www.aia.es <http://www.aia.es> *
>>>>> Josep Mª Formentí Serra       <jm...@aia.ptv.es>
>>>>> *jmformenti@aia.es <jm...@aia.ptv.es>*Dpto. Servicios
>> Financieros y
>>>>> Seguros
>>>>> ESADECREAPOLIS, Sant Cugat, Barcelona
>>>>> Telf.: +34 93 504 49 00 <+34%20935%2004%2049%2000> Fax.: +34 93 580 21
>>>> 88
>>>>> <+34%20935%2080%2021%2088>
>>>>> -------------------------------------------------------------------
>> ---
>>>> --
>>>>> - - -
>>>>> The information transmitted is intended only for the person or entity
>> to
>>>>> which it is addressed and may contain confidential and/or privileged
>>>>> material. Any review, retransmission, dissemination or other use of, or
>>>>> taking of any action in reliance upon, this information by persons or
>>>>> entities other than the intended recipient is prohibited. If you
>> received
>>>>> this in error, please contact the sender and delete the material from
>> any
>>>>> computer.
>>
>


Re: UIMA Ruta thread safe

Posted by Josep María Formentí Serra <jm...@aia.es>.
Hi Peter,

> Ok, so you have no script file for the rules executed in the analysis
> engine but use the rules parameter, right? Did you import the type
> system containing the type in the rule string?

Yes, we use the rules parameter and do the import.

Really we have a ruta engine for each "control rule", each engine use the
rules parameter and each "control rule" starts with:

PACKAGE com.aia.tas.uima.types;
DECLARE ControlRuleDetection;

Best,



2017-06-09 13:22 GMT+02:00 Peter Klügl <pe...@averbis.com>:

> Hi,
>
>
> Am 09.06.2017 um 11:52 schrieb Josep María Formentí Serra:
> > Thanks Hugues, suggestion of JCasPool is very interesting, we have some
> > doubts but I'll open another thread for that.
> >
> > Regarding our problem with concurrent requests, we tried to use
> > stricImports but then appears another exception (but other exceptions can
> > appears):
> >
> > Caused by: java.lang.RuntimeException: Type 'com.aia.tas.uima.types.
> > Anonymous.ControlRuleDetection' not found
> >
> >                 at org.apache.uima.ruta.RutaEnvironment.
> importDeclaredTypes(
> > RutaEnvironment.java:310)
> >
> >
> > We have the type 'com.aia.tas.uima.types.ControlRuleDetection' without
> > Anonymous.
>
> Ok, so you have no script file for the rules executed in the analysis
> engine but use the rules parameter, right? Did you import the type
> system containing the type in the rule string?
>
>
> Best,
>
> Peter
>
>
> >
> > Temporaly we have a workaround, we did a wrapper of RutaEngine putting a
> > synchronized in the process method, doing this all is working properly.
> >
> >
> >
> >
> >
> > 2017-06-06 15:49 GMT+02:00 Hugues de Mazancourt <hu...@mazancourt.com>:
> >
> >> Hi,
> >>
> >> From my experience, Ruta is actually thread-safe and use of «
> >> strictImports » solves many of the type ambiguities between Ruta and
> DKPro.
> >> In a concurrent environment, you will certainly gain performance by
> using
> >> a JCasPool for creating your CASes
> >>
> >> Best,
> >>
> >>
> >> — Hugues de Mazancourt
> >>
> >>
> >>
> >>> Le 6 juin 2017 à 15:13, Josep María Formentí Serra <jm...@aia.es>
> >> a écrit :
> >>> Thanks Peter,
> >>>
> >>>> Could it be that you create the CAS differently in your concurrent
> >>>> setting? For example JCasFactory vs ae.newCAS()?
> >>> CAS is created ever using JCasFactory, we revise if there are something
> >>> wrong in the reader.
> >>>
> >>>> Anyways, this exception in this situation (using DKPro Core) is really
> >>>> annoying. Did you try to activate strictImports?
> >>> It's really annoying, we have a set of requests to test the web
> service.
> >> If
> >>> we execute the set of test with one thread all is ok, no exception, but
> >>> when we execute the same set with more than one thread, the exceptions
> >>> appears.
> >>>
> >>>> If this does not help, do you have a minimal reproducible example?
> >>> No, I haven't, I'll check the code and if I don't find the solution,
> I'll
> >>> try to prepare a minimal example to reproduce the problem
> >>>
> >>> 2017-06-06 11:46 GMT+02:00 Peter Klügl <pe...@averbis.com>:
> >>>
> >>>> Hi,
> >>>>
> >>>>
> >>>> UIMA Ruta should be threadsafe.
> >>>>
> >>>>
> >>>> Could it be that you create the CAS differently in your concurrent
> >>>> setting? For example JCasFactory vs ae.newCAS()?
> >>>>
> >>>> The exception indicates that Ruta cannot resolve the mention
> "Document"
> >>>> correctly since it is an alias of uima.tcas.DocumentAnnotation and the
> >>>> short name of the DKPro type. This exception should also occur in a
> >>>> non-concurrent setting.
> >>>>
> >>>> Anyways, this exception in this situation (using DKPro Core) is really
> >>>> annoying. Did you try to activate strictImports?
> >>>>
> >>>>
> >>>> If this does not help, do you have a minimal reproducible example?
> >>>>
> >>>>
> >>>>
> >>>> Best,
> >>>>
> >>>> Peter
> >>>>
> >>>>
> >>>> Am 06.06.2017 um 11:03 schrieb Josep María Formentí Serra:
> >>>>> Hi all,
> >>>>>
> >>>>>  We are building a web service using directly the RutaEngine, in the
> >>>>> inicialization the engine is built as:
> >>>>>
> >>>>> UIMAFramework.produceAnalysisEngine(AnalysisEngineFactory
> >>>>>
> >>>>> .createEngineDescription(createEngineDescription(RutaEngine.class,
> >>>>>                                            RutaEngine.PARAM_RULES,
> >>>>> rule.getRule().getConditions()))));
> >>>>>
> >>>>>  And then we call method *process *passing the *JCas*.
> >>>>>
> >>>>>  All is ok but when we receive concurrent requests, starts to appears
> >>>> many
> >>>>> exceptions like these:
> >>>>>
> >>>>> Caused by: java.lang.IllegalArgumentException: Document is
> ambiguous,
> >>>> use
> >>>>> one of the following instead : uima.tcas.DocumentAnnotation
> >>>>> de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Document
> >>>>>    at
> >>>>> org.apache.uima.ruta.RutaEnvironment.getType(
> RutaEnvironment.java:459)
> >>>>> ~[ruta-core-2.6.0.jar:2.6.0]
> >>>>>
> >>>>> Caused by: java.lang.NullPointerException: null
> >>>>>    at java.util.ArrayList.addAll(ArrayList.java:577) ~[na:1.8.0_66]
> >>>>>    at
> >>>>> org.apache.uima.ruta.condition.ImplicitCondition.eval(
> >>>> ImplicitCondition.java:70)
> >>>>> ~[ruta-core-2.6.0.jar:2.6.0]
> >>>>>
> >>>>>  Is UIMA Ruta thread safe? we are doing something wrong?
> >>>>>
> >>>>> Thanks in advance,
> >>>>>  JM
> >>>>>
> >>>>
> >>>
> >>> --
> >>> -------------------------------------------------------------------
> ---
> >> --
> >>> - - -
> >>> *Grupo AIA* - *www.aia.es <http://www.aia.es> *
> >>> Josep Mª Formentí Serra       <jm...@aia.ptv.es>
> >>> *jmformenti@aia.es <jm...@aia.ptv.es>*Dpto. Servicios
> Financieros y
> >>> Seguros
> >>> ESADECREAPOLIS, Sant Cugat, Barcelona
> >>> Telf.: +34 93 504 49 00 <+34%20935%2004%2049%2000> Fax.: +34 93 580 21
> >> 88
> >>> <+34%20935%2080%2021%2088>
> >>> -------------------------------------------------------------------
> ---
> >> --
> >>> - - -
> >>> The information transmitted is intended only for the person or entity
> to
> >>> which it is addressed and may contain confidential and/or privileged
> >>> material. Any review, retransmission, dissemination or other use of, or
> >>> taking of any action in reliance upon, this information by persons or
> >>> entities other than the intended recipient is prohibited. If you
> received
> >>> this in error, please contact the sender and delete the material from
> any
> >>> computer.
> >>
> >
>
>


-- 
------------------------------------------------------------------- --- --
- - -
*Grupo AIA* - *www.aia.es <http://www.aia.es> *
Josep Mª Formentí Serra       <jm...@aia.ptv.es>
*jmformenti@aia.es <jm...@aia.ptv.es>*Dpto. Servicios Financieros y
Seguros
ESADECREAPOLIS, Sant Cugat, Barcelona
Telf.: +34 93 504 49 00 Fax.: +34 93 580 21 88
------------------------------------------------------------------- --- --
- - -
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.

Re: UIMA Ruta thread safe

Posted by Peter Klügl <pe...@averbis.com>.
Hi,


Am 09.06.2017 um 11:52 schrieb Josep María Formentí Serra:
> Thanks Hugues, suggestion of JCasPool is very interesting, we have some
> doubts but I'll open another thread for that.
>
> Regarding our problem with concurrent requests, we tried to use
> stricImports but then appears another exception (but other exceptions can
> appears):
>
> Caused by: java.lang.RuntimeException: Type 'com.aia.tas.uima.types.
> Anonymous.ControlRuleDetection' not found
>
>                 at org.apache.uima.ruta.RutaEnvironment.importDeclaredTypes(
> RutaEnvironment.java:310)
>
>
> We have the type 'com.aia.tas.uima.types.ControlRuleDetection' without
> Anonymous.

Ok, so you have no script file for the rules executed in the analysis
engine but use the rules parameter, right? Did you import the type
system containing the type in the rule string?


Best,

Peter


>
> Temporaly we have a workaround, we did a wrapper of RutaEngine putting a
> synchronized in the process method, doing this all is working properly.
>
>
>
>
>
> 2017-06-06 15:49 GMT+02:00 Hugues de Mazancourt <hu...@mazancourt.com>:
>
>> Hi,
>>
>> From my experience, Ruta is actually thread-safe and use of «
>> strictImports » solves many of the type ambiguities between Ruta and DKPro.
>> In a concurrent environment, you will certainly gain performance by using
>> a JCasPool for creating your CASes
>>
>> Best,
>>
>>
>> — Hugues de Mazancourt
>>
>>
>>
>>> Le 6 juin 2017 à 15:13, Josep María Formentí Serra <jm...@aia.es>
>> a écrit :
>>> Thanks Peter,
>>>
>>>> Could it be that you create the CAS differently in your concurrent
>>>> setting? For example JCasFactory vs ae.newCAS()?
>>> CAS is created ever using JCasFactory, we revise if there are something
>>> wrong in the reader.
>>>
>>>> Anyways, this exception in this situation (using DKPro Core) is really
>>>> annoying. Did you try to activate strictImports?
>>> It's really annoying, we have a set of requests to test the web service.
>> If
>>> we execute the set of test with one thread all is ok, no exception, but
>>> when we execute the same set with more than one thread, the exceptions
>>> appears.
>>>
>>>> If this does not help, do you have a minimal reproducible example?
>>> No, I haven't, I'll check the code and if I don't find the solution, I'll
>>> try to prepare a minimal example to reproduce the problem
>>>
>>> 2017-06-06 11:46 GMT+02:00 Peter Klügl <pe...@averbis.com>:
>>>
>>>> Hi,
>>>>
>>>>
>>>> UIMA Ruta should be threadsafe.
>>>>
>>>>
>>>> Could it be that you create the CAS differently in your concurrent
>>>> setting? For example JCasFactory vs ae.newCAS()?
>>>>
>>>> The exception indicates that Ruta cannot resolve the mention "Document"
>>>> correctly since it is an alias of uima.tcas.DocumentAnnotation and the
>>>> short name of the DKPro type. This exception should also occur in a
>>>> non-concurrent setting.
>>>>
>>>> Anyways, this exception in this situation (using DKPro Core) is really
>>>> annoying. Did you try to activate strictImports?
>>>>
>>>>
>>>> If this does not help, do you have a minimal reproducible example?
>>>>
>>>>
>>>>
>>>> Best,
>>>>
>>>> Peter
>>>>
>>>>
>>>> Am 06.06.2017 um 11:03 schrieb Josep María Formentí Serra:
>>>>> Hi all,
>>>>>
>>>>>  We are building a web service using directly the RutaEngine, in the
>>>>> inicialization the engine is built as:
>>>>>
>>>>> UIMAFramework.produceAnalysisEngine(AnalysisEngineFactory
>>>>>
>>>>> .createEngineDescription(createEngineDescription(RutaEngine.class,
>>>>>                                            RutaEngine.PARAM_RULES,
>>>>> rule.getRule().getConditions()))));
>>>>>
>>>>>  And then we call method *process *passing the *JCas*.
>>>>>
>>>>>  All is ok but when we receive concurrent requests, starts to appears
>>>> many
>>>>> exceptions like these:
>>>>>
>>>>> Caused by: java.lang.IllegalArgumentException: Document is ambiguous,
>>>> use
>>>>> one of the following instead : uima.tcas.DocumentAnnotation
>>>>> de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Document
>>>>>    at
>>>>> org.apache.uima.ruta.RutaEnvironment.getType(RutaEnvironment.java:459)
>>>>> ~[ruta-core-2.6.0.jar:2.6.0]
>>>>>
>>>>> Caused by: java.lang.NullPointerException: null
>>>>>    at java.util.ArrayList.addAll(ArrayList.java:577) ~[na:1.8.0_66]
>>>>>    at
>>>>> org.apache.uima.ruta.condition.ImplicitCondition.eval(
>>>> ImplicitCondition.java:70)
>>>>> ~[ruta-core-2.6.0.jar:2.6.0]
>>>>>
>>>>>  Is UIMA Ruta thread safe? we are doing something wrong?
>>>>>
>>>>> Thanks in advance,
>>>>>  JM
>>>>>
>>>>
>>>
>>> --
>>> ------------------------------------------------------------------- ---
>> --
>>> - - -
>>> *Grupo AIA* - *www.aia.es <http://www.aia.es> *
>>> Josep Mª Formentí Serra       <jm...@aia.ptv.es>
>>> *jmformenti@aia.es <jm...@aia.ptv.es>*Dpto. Servicios Financieros y
>>> Seguros
>>> ESADECREAPOLIS, Sant Cugat, Barcelona
>>> Telf.: +34 93 504 49 00 <+34%20935%2004%2049%2000> Fax.: +34 93 580 21
>> 88
>>> <+34%20935%2080%2021%2088>
>>> ------------------------------------------------------------------- ---
>> --
>>> - - -
>>> The information transmitted is intended only for the person or entity to
>>> which it is addressed and may contain confidential and/or privileged
>>> material. Any review, retransmission, dissemination or other use of, or
>>> taking of any action in reliance upon, this information by persons or
>>> entities other than the intended recipient is prohibited. If you received
>>> this in error, please contact the sender and delete the material from any
>>> computer.
>>
>


Re: UIMA Ruta thread safe

Posted by Josep María Formentí Serra <jm...@aia.es>.
Thanks Hugues, suggestion of JCasPool is very interesting, we have some
doubts but I'll open another thread for that.

Regarding our problem with concurrent requests, we tried to use
stricImports but then appears another exception (but other exceptions can
appears):

Caused by: java.lang.RuntimeException: Type 'com.aia.tas.uima.types.
Anonymous.ControlRuleDetection' not found

                at org.apache.uima.ruta.RutaEnvironment.importDeclaredTypes(
RutaEnvironment.java:310)


We have the type 'com.aia.tas.uima.types.ControlRuleDetection' without
Anonymous.


Temporaly we have a workaround, we did a wrapper of RutaEngine putting a
synchronized in the process method, doing this all is working properly.





2017-06-06 15:49 GMT+02:00 Hugues de Mazancourt <hu...@mazancourt.com>:

> Hi,
>
> From my experience, Ruta is actually thread-safe and use of «
> strictImports » solves many of the type ambiguities between Ruta and DKPro.
> In a concurrent environment, you will certainly gain performance by using
> a JCasPool for creating your CASes
>
> Best,
>
>
> — Hugues de Mazancourt
>
>
>
> > Le 6 juin 2017 à 15:13, Josep María Formentí Serra <jm...@aia.es>
> a écrit :
> >
> > Thanks Peter,
> >
> >> Could it be that you create the CAS differently in your concurrent
> >> setting? For example JCasFactory vs ae.newCAS()?
> >
> > CAS is created ever using JCasFactory, we revise if there are something
> > wrong in the reader.
> >
> >> Anyways, this exception in this situation (using DKPro Core) is really
> >> annoying. Did you try to activate strictImports?
> >
> > It's really annoying, we have a set of requests to test the web service.
> If
> > we execute the set of test with one thread all is ok, no exception, but
> > when we execute the same set with more than one thread, the exceptions
> > appears.
> >
> >> If this does not help, do you have a minimal reproducible example?
> >
> > No, I haven't, I'll check the code and if I don't find the solution, I'll
> > try to prepare a minimal example to reproduce the problem
> >
> > 2017-06-06 11:46 GMT+02:00 Peter Klügl <pe...@averbis.com>:
> >
> >> Hi,
> >>
> >>
> >> UIMA Ruta should be threadsafe.
> >>
> >>
> >> Could it be that you create the CAS differently in your concurrent
> >> setting? For example JCasFactory vs ae.newCAS()?
> >>
> >> The exception indicates that Ruta cannot resolve the mention "Document"
> >> correctly since it is an alias of uima.tcas.DocumentAnnotation and the
> >> short name of the DKPro type. This exception should also occur in a
> >> non-concurrent setting.
> >>
> >> Anyways, this exception in this situation (using DKPro Core) is really
> >> annoying. Did you try to activate strictImports?
> >>
> >>
> >> If this does not help, do you have a minimal reproducible example?
> >>
> >>
> >>
> >> Best,
> >>
> >> Peter
> >>
> >>
> >> Am 06.06.2017 um 11:03 schrieb Josep María Formentí Serra:
> >>> Hi all,
> >>>
> >>>  We are building a web service using directly the RutaEngine, in the
> >>> inicialization the engine is built as:
> >>>
> >>> UIMAFramework.produceAnalysisEngine(AnalysisEngineFactory
> >>>
> >>> .createEngineDescription(createEngineDescription(RutaEngine.class,
> >>>                                            RutaEngine.PARAM_RULES,
> >>> rule.getRule().getConditions()))));
> >>>
> >>>  And then we call method *process *passing the *JCas*.
> >>>
> >>>  All is ok but when we receive concurrent requests, starts to appears
> >> many
> >>> exceptions like these:
> >>>
> >>> Caused by: java.lang.IllegalArgumentException: Document is ambiguous,
> >> use
> >>> one of the following instead : uima.tcas.DocumentAnnotation
> >>> de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Document
> >>>    at
> >>> org.apache.uima.ruta.RutaEnvironment.getType(RutaEnvironment.java:459)
> >>> ~[ruta-core-2.6.0.jar:2.6.0]
> >>>
> >>> Caused by: java.lang.NullPointerException: null
> >>>    at java.util.ArrayList.addAll(ArrayList.java:577) ~[na:1.8.0_66]
> >>>    at
> >>> org.apache.uima.ruta.condition.ImplicitCondition.eval(
> >> ImplicitCondition.java:70)
> >>> ~[ruta-core-2.6.0.jar:2.6.0]
> >>>
> >>>  Is UIMA Ruta thread safe? we are doing something wrong?
> >>>
> >>> Thanks in advance,
> >>>  JM
> >>>
> >>
> >>
> >
> >
> > --
> > ------------------------------------------------------------------- ---
> --
> > - - -
> > *Grupo AIA* - *www.aia.es <http://www.aia.es> *
> > Josep Mª Formentí Serra       <jm...@aia.ptv.es>
> > *jmformenti@aia.es <jm...@aia.ptv.es>*Dpto. Servicios Financieros y
> > Seguros
> > ESADECREAPOLIS, Sant Cugat, Barcelona
> > Telf.: +34 93 504 49 00 <+34%20935%2004%2049%2000> Fax.: +34 93 580 21
> 88
> > <+34%20935%2080%2021%2088>
> > ------------------------------------------------------------------- ---
> --
> > - - -
> > The information transmitted is intended only for the person or entity to
> > which it is addressed and may contain confidential and/or privileged
> > material. Any review, retransmission, dissemination or other use of, or
> > taking of any action in reliance upon, this information by persons or
> > entities other than the intended recipient is prohibited. If you received
> > this in error, please contact the sender and delete the material from any
> > computer.
>
>


-- 
------------------------------------------------------------------- --- --
- - -
*Grupo AIA* - *www.aia.es <http://www.aia.es> *
Josep Mª Formentí Serra       <jm...@aia.ptv.es>
*jmformenti@aia.es <jm...@aia.ptv.es>*Dpto. Servicios Financieros y
Seguros
ESADECREAPOLIS, Sant Cugat, Barcelona
Telf.: +34 93 504 49 00 <+34%20935%2004%2049%2000> Fax.: +34 93 580 21 88
<+34%20935%2080%2021%2088>
------------------------------------------------------------------- --- --
- - -
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.

Re: UIMA Ruta thread safe

Posted by Hugues de Mazancourt <hu...@mazancourt.com>.
Hi,

From my experience, Ruta is actually thread-safe and use of « strictImports » solves many of the type ambiguities between Ruta and DKPro.
In a concurrent environment, you will certainly gain performance by using a JCasPool for creating your CASes

Best,


— Hugues de Mazancourt



> Le 6 juin 2017 à 15:13, Josep María Formentí Serra <jm...@aia.es> a écrit :
> 
> Thanks Peter,
> 
>> Could it be that you create the CAS differently in your concurrent
>> setting? For example JCasFactory vs ae.newCAS()?
> 
> CAS is created ever using JCasFactory, we revise if there are something
> wrong in the reader.
> 
>> Anyways, this exception in this situation (using DKPro Core) is really
>> annoying. Did you try to activate strictImports?
> 
> It's really annoying, we have a set of requests to test the web service. If
> we execute the set of test with one thread all is ok, no exception, but
> when we execute the same set with more than one thread, the exceptions
> appears.
> 
>> If this does not help, do you have a minimal reproducible example?
> 
> No, I haven't, I'll check the code and if I don't find the solution, I'll
> try to prepare a minimal example to reproduce the problem
> 
> 2017-06-06 11:46 GMT+02:00 Peter Klügl <pe...@averbis.com>:
> 
>> Hi,
>> 
>> 
>> UIMA Ruta should be threadsafe.
>> 
>> 
>> Could it be that you create the CAS differently in your concurrent
>> setting? For example JCasFactory vs ae.newCAS()?
>> 
>> The exception indicates that Ruta cannot resolve the mention "Document"
>> correctly since it is an alias of uima.tcas.DocumentAnnotation and the
>> short name of the DKPro type. This exception should also occur in a
>> non-concurrent setting.
>> 
>> Anyways, this exception in this situation (using DKPro Core) is really
>> annoying. Did you try to activate strictImports?
>> 
>> 
>> If this does not help, do you have a minimal reproducible example?
>> 
>> 
>> 
>> Best,
>> 
>> Peter
>> 
>> 
>> Am 06.06.2017 um 11:03 schrieb Josep María Formentí Serra:
>>> Hi all,
>>> 
>>>  We are building a web service using directly the RutaEngine, in the
>>> inicialization the engine is built as:
>>> 
>>> UIMAFramework.produceAnalysisEngine(AnalysisEngineFactory
>>> 
>>> .createEngineDescription(createEngineDescription(RutaEngine.class,
>>>                                            RutaEngine.PARAM_RULES,
>>> rule.getRule().getConditions()))));
>>> 
>>>  And then we call method *process *passing the *JCas*.
>>> 
>>>  All is ok but when we receive concurrent requests, starts to appears
>> many
>>> exceptions like these:
>>> 
>>> Caused by: java.lang.IllegalArgumentException: Document is ambiguous,
>> use
>>> one of the following instead : uima.tcas.DocumentAnnotation
>>> de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Document
>>>    at
>>> org.apache.uima.ruta.RutaEnvironment.getType(RutaEnvironment.java:459)
>>> ~[ruta-core-2.6.0.jar:2.6.0]
>>> 
>>> Caused by: java.lang.NullPointerException: null
>>>    at java.util.ArrayList.addAll(ArrayList.java:577) ~[na:1.8.0_66]
>>>    at
>>> org.apache.uima.ruta.condition.ImplicitCondition.eval(
>> ImplicitCondition.java:70)
>>> ~[ruta-core-2.6.0.jar:2.6.0]
>>> 
>>>  Is UIMA Ruta thread safe? we are doing something wrong?
>>> 
>>> Thanks in advance,
>>>  JM
>>> 
>> 
>> 
> 
> 
> -- 
> ------------------------------------------------------------------- --- --
> - - -
> *Grupo AIA* - *www.aia.es <http://www.aia.es> *
> Josep Mª Formentí Serra       <jm...@aia.ptv.es>
> *jmformenti@aia.es <jm...@aia.ptv.es>*Dpto. Servicios Financieros y
> Seguros
> ESADECREAPOLIS, Sant Cugat, Barcelona
> Telf.: +34 93 504 49 00 <+34%20935%2004%2049%2000> Fax.: +34 93 580 21 88
> <+34%20935%2080%2021%2088>
> ------------------------------------------------------------------- --- --
> - - -
> The information transmitted is intended only for the person or entity to
> which it is addressed and may contain confidential and/or privileged
> material. Any review, retransmission, dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipient is prohibited. If you received
> this in error, please contact the sender and delete the material from any
> computer.


Re: UIMA Ruta thread safe

Posted by Josep María Formentí Serra <jm...@aia.es>.
Thanks Peter,

> Could it be that you create the CAS differently in your concurrent
> setting? For example JCasFactory vs ae.newCAS()?

CAS is created ever using JCasFactory, we revise if there are something
wrong in the reader.

> Anyways, this exception in this situation (using DKPro Core) is really
> annoying. Did you try to activate strictImports?

It's really annoying, we have a set of requests to test the web service. If
we execute the set of test with one thread all is ok, no exception, but
when we execute the same set with more than one thread, the exceptions
appears.

> If this does not help, do you have a minimal reproducible example?

No, I haven't, I'll check the code and if I don't find the solution, I'll
try to prepare a minimal example to reproduce the problem

2017-06-06 11:46 GMT+02:00 Peter Klügl <pe...@averbis.com>:

> Hi,
>
>
> UIMA Ruta should be threadsafe.
>
>
> Could it be that you create the CAS differently in your concurrent
> setting? For example JCasFactory vs ae.newCAS()?
>
> The exception indicates that Ruta cannot resolve the mention "Document"
> correctly since it is an alias of uima.tcas.DocumentAnnotation and the
> short name of the DKPro type. This exception should also occur in a
> non-concurrent setting.
>
> Anyways, this exception in this situation (using DKPro Core) is really
> annoying. Did you try to activate strictImports?
>
>
> If this does not help, do you have a minimal reproducible example?
>
>
>
> Best,
>
> Peter
>
>
> Am 06.06.2017 um 11:03 schrieb Josep María Formentí Serra:
> > Hi all,
> >
> >   We are building a web service using directly the RutaEngine, in the
> > inicialization the engine is built as:
> >
> > UIMAFramework.produceAnalysisEngine(AnalysisEngineFactory
> >
> > .createEngineDescription(createEngineDescription(RutaEngine.class,
> >                                             RutaEngine.PARAM_RULES,
> > rule.getRule().getConditions()))));
> >
> >   And then we call method *process *passing the *JCas*.
> >
> >   All is ok but when we receive concurrent requests, starts to appears
> many
> > exceptions like these:
> >
> > Caused by: java.lang.IllegalArgumentException: Document is ambiguous,
> use
> > one of the following instead : uima.tcas.DocumentAnnotation
> > de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Document
> >     at
> > org.apache.uima.ruta.RutaEnvironment.getType(RutaEnvironment.java:459)
> > ~[ruta-core-2.6.0.jar:2.6.0]
> >
> > Caused by: java.lang.NullPointerException: null
> >     at java.util.ArrayList.addAll(ArrayList.java:577) ~[na:1.8.0_66]
> >     at
> > org.apache.uima.ruta.condition.ImplicitCondition.eval(
> ImplicitCondition.java:70)
> > ~[ruta-core-2.6.0.jar:2.6.0]
> >
> >   Is UIMA Ruta thread safe? we are doing something wrong?
> >
> > Thanks in advance,
> >   JM
> >
>
>


-- 
------------------------------------------------------------------- --- --
- - -
*Grupo AIA* - *www.aia.es <http://www.aia.es> *
Josep Mª Formentí Serra       <jm...@aia.ptv.es>
*jmformenti@aia.es <jm...@aia.ptv.es>*Dpto. Servicios Financieros y
Seguros
ESADECREAPOLIS, Sant Cugat, Barcelona
Telf.: +34 93 504 49 00 <+34%20935%2004%2049%2000> Fax.: +34 93 580 21 88
<+34%20935%2080%2021%2088>
------------------------------------------------------------------- --- --
- - -
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.

Re: UIMA Ruta thread safe

Posted by Peter Klügl <pe...@averbis.com>.
Hi,


UIMA Ruta should be threadsafe.


Could it be that you create the CAS differently in your concurrent
setting? For example JCasFactory vs ae.newCAS()?

The exception indicates that Ruta cannot resolve the mention "Document"
correctly since it is an alias of uima.tcas.DocumentAnnotation and the
short name of the DKPro type. This exception should also occur in a
non-concurrent setting.

Anyways, this exception in this situation (using DKPro Core) is really
annoying. Did you try to activate strictImports?


If this does not help, do you have a minimal reproducible example?



Best,

Peter
 

Am 06.06.2017 um 11:03 schrieb Josep María Formentí Serra:
> Hi all,
>
>   We are building a web service using directly the RutaEngine, in the
> inicialization the engine is built as:
>
> UIMAFramework.produceAnalysisEngine(AnalysisEngineFactory
>
> .createEngineDescription(createEngineDescription(RutaEngine.class,
>                                             RutaEngine.PARAM_RULES,
> rule.getRule().getConditions()))));
>
>   And then we call method *process *passing the *JCas*.
>
>   All is ok but when we receive concurrent requests, starts to appears many
> exceptions like these:
>
> Caused by: java.lang.IllegalArgumentException: Document is ambiguous, use
> one of the following instead : uima.tcas.DocumentAnnotation
> de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Document
>     at
> org.apache.uima.ruta.RutaEnvironment.getType(RutaEnvironment.java:459)
> ~[ruta-core-2.6.0.jar:2.6.0]
>
> Caused by: java.lang.NullPointerException: null
>     at java.util.ArrayList.addAll(ArrayList.java:577) ~[na:1.8.0_66]
>     at
> org.apache.uima.ruta.condition.ImplicitCondition.eval(ImplicitCondition.java:70)
> ~[ruta-core-2.6.0.jar:2.6.0]
>
>   Is UIMA Ruta thread safe? we are doing something wrong?
>
> Thanks in advance,
>   JM
>