ctakes-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From satyananda sahu <satyananda...@gmail.com>
Subject Re: Analysis Engine Process Exception while querying ctakes Service frequently
Date Wed, 06 Mar 2019 11:39:41 GMT
@RequestMapping(value = "/analyze", method = RequestMethod.POST)
   @ResponseBody
   public Map<String, List<String>> getAnalyzedJSON(@RequestBody String
analysisText) throws ServletException, IOException {
       Map<String, List<String>> resultMap = null;
       if (analysisText != null && analysisText.trim().length() > 0) {
           JCas jcas = pool.getJCas(-1);
           try {
               jcas.setDocumentText(analysisText);
               engine. .process(jcas);

//check this might help you
              *jcas.reset();*



               resultMap = formatResults(jcas);
           } catch (Exception e) {
               e.printStackTrace();
               throw new ServletException(e);
           } finally {
                pool.releaseJCas(jcas); //Releasing JCas
           }
       }
        return resultMap;
   }

check this link:
https://uima.apache.org/d/uimaj-current/apidocs/org/apache/uima/analysis_engine/AnalysisEngine.html

On Wed, Mar 6, 2019 at 3:14 PM Zakir Saifi <zakir.saifi@raxa.com> wrote:

> Hi @Satyananda Sahu
> Could you elaborate about how r*esetting the annotators and process
> engine*?.
> I currently releasing the JCas pool after each rest call and in case of an
> exception, I am also releasing the JCas.
>
> Here is my code. Post construct work only for the First time. Then the
> subsequent Rest calls process JCas and release after the use.
>
> @PostConstruct
>     public void init() throws ServletException {
>         LOGGER.info("Initializing analysis engine and jcas pool");
>         try {
>             final File inputFile    = FileLocator.getFile(PIPER_FILE_PATH);
>             PiperFileReader reader  = new
> PiperFileReader(inputFile.getAbsolutePath());
>             PipelineBuilder builder = reader.getBuilder();
>             AnalysisEngineDescription analysisEngineDesc =
> builder.getAnalysisEngineDesc();
>             engine =
> UIMAFramework.produceAnalysisEngine(analysisEngineDesc);
>             pool = new JCasPool(300, engine);
>         } catch (Exception e) {
>             e.printStackTrace();
>             throw new ServletException(e);
>         }
>     }
>
> @RequestMapping(value = "/analyze", method = RequestMethod.POST)
>    @ResponseBody
>    public Map<String, List<String>> getAnalyzedJSON(@RequestBody String
> analysisText) throws ServletException, IOException {
>        Map<String, List<String>> resultMap = null;
>        if (analysisText != null && analysisText.trim().length() > 0) {
>            JCas jcas = pool.getJCas(-1);
>            try {
>                jcas.setDocumentText(analysisText);
>                engine. .process(jcas);
>                resultMap = formatResults(jcas);
>            } catch (Exception e) {
>                e.printStackTrace();
>                throw new ServletException(e);
>            } finally {
>                 pool.releaseJCas(jcas); //Releasing JCas
>            }
>        }
>         return resultMap;
>    }
>
>
>
> On Wed, Mar 6, 2019 at 12:42 PM satyananda sahu <satyananda123@gmail.com>
> wrote:
>
> > Reset the annotators and process engine for each call and it should work
> > for you.
> >
> > Thanks,
> > Satya
> >
> > On Tue, Mar 5, 2019 at 3:12 PM Zakir Saifi <zakir.saifi@raxa.com> wrote:
> >
> > > Hi all,
> > >
> > > I using Ctakes Rest Service(a Rest Server based on Apache Ctakes) for
> > > benchmarking using *Apache Jmeter*. As I have to use it as Rest Server
> to
> > > processing many clinical Text
> > >
> > > My Configuration for BenchMarking are as follows:
> > > I am creating 10 users(threads) each with Ramp up period (*10s*). *That
> > > means 1 user is created after every 1 second. *
> > > I have loop count of *5* (Number of iteration)
> > > There is a time delay of *500ms* between each subsequent Request ( To
> > > simulate requests as in real-time scenarios, real-users give delays
> > between
> > > doing different actions.)
> > > I am also changing the *data* with each request by using data from CSV
> > > file.
> > >
> > > I am getting following exceptions for most* of the requests* that comes
> > to
> > > Ctakes Rest Sever
> > >
> > > Exception1
> > > org.apache.uima.analysis_engine.s: Annotator processing failed.
> > > at
> > >
> > >
> >
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:391)
> > > at
> > >
> > >
> >
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:296)
> > > at
> > >
> > >
> >
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:567)
> > > 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.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
> > > at
> > >
> > >
> >
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:280)
> > > at
> > >
> > >
> >
> org.apache.ctakes.rest.service.CtakesRestController.getAnalyzedJSON(CtakesRestController.java:95)
> > > at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
> > > at
> > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > at java.lang.reflect.Method.invoke(Method.java:498)
> > > at
> > >
> > >
> >
> org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
> > > at
> > >
> > >
> >
> org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> > > at
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
> > > at
> > >
> > >
> >
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
> > > at
> > >
> > >
> >
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
> > > at
> > >
> > >
> >
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
> > > at
> > >
> > >
> >
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
> > > at
> > >
> >
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
> > > at
> > >
> >
> org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
> > > at
> > >
> > >
> >
> org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
> > > at
> > >
> > >
> >
> org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
> > > at
> > > org.apache.tomcat.util.net
> > > .NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
> > > at
> > > org.apache.tomcat.util.net
> > > .SocketProcessorBase.run(SocketProcessorBase.java:49)
> > > at
> > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> > > at
> > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> > > at
> > >
> > >
> >
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> > > at java.lang.Thread.run(Thread.java:748)
> > > Caused by: java.lang.NullPointerException
> > >
> > > Exception2
> > > 05-Mar-2019 08:45:32.274 SEVERE [http-nio-8089-exec-3]
> > >
> > >
> >
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(275)
> > > Exception occurred
> > >  org.apache.uima.analysis_engine.AnalysisEngineProcessException:
> > Annotator
> > > processing failed.
> > > at
> > >
> > >
> >
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:391)
> > > at
> > >
> > >
> >
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:296)
> > > at
> > >
> > >
> >
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:567)
> > > 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.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
> > > at
> > >
> > >
> >
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:280)
> > > at
> > >
> > >
> >
> org.apache.ctakes.rest.service.CtakesRestController.getAnalyzedJSON(CtakesRestController.java:95)
> > > at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
> > > at
> > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > at java.lang.reflect.Method.invoke(Method.java:498)
> > > at
> > >
> > >
> >
> org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
> > > at
> > >
> > >
> >
> org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
> > > at
> > >
> > >
> >
> org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> > > at
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
> > > at
> > >
> > >
> >
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
> > > at
> > >
> > >
> >
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
> > > at
> > >
> > >
> >
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
> > > at
> > >
> > >
> >
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
> > > at
> > >
> > >
> >
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
> > > at
> > >
> >
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
> > > at
> > >
> >
> org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
> > > at
> > >
> > >
> >
> org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
> > > at
> > >
> > >
> >
> org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
> > > at
> > > org.apache.tomcat.util.net
> > > .NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
> > > at
> > > org.apache.tomcat.util.net
> > > .SocketProcessorBase.run(SocketProcessorBase.java:49)
> > > at
> > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> > > at
> > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> > > at
> > >
> > >
> >
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> > > at java.lang.Thread.run(Thread.java:748)
> > > Caused by: java.lang.NullPointerException
> > >
> > >
> > > I have recently changed the *minimum span detection to 1 *and also not
> > > excluding any exclusion tags in my Piper files. Since then I am seeing
> > this
> > > errors coming more frequently. I don't think these errors are
> associated
> > > with any particular type of data to goes to ctakes Service.Because if I
> > > increase the time between the subsequent user creation and Time delay
> > > between the subsequent call, I am not getting any exception.
> > >
> > > I am currently running *Ctakes Rest Server* war in a Docker Container
> > > having tomcat image with JVM Maximum Memory of* 3 GB.*  Anyone have
> idea
> > > why I am getting these exception on heavy load??
> > >
> > >
> > >
> > >
> > > Regards
> > > Zakir Saifi
> > >
> >
>
>
> --
> Regards
> Zakir Saifi
> (Software Developer at Raxa)
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message