You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Richard Eckart de Castilho (Jira)" <de...@uima.apache.org> on 2021/12/10 17:35:00 UTC

[jira] [Commented] (UIMA-6399) RutaPatternCache prevents CPEEngine from terminating

    [ https://issues.apache.org/jira/browse/UIMA-6399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17457291#comment-17457291 ] 

Richard Eckart de Castilho commented on UIMA-6399:
--------------------------------------------------

It looks like we cannot fix this in the CPEEngine. The new thread spawned within the threads that belong to this group. There is no way to intercept the thread being added to the `CPMThreadGroup` because `ThreadGroup.add()` is protected. There is also no way to move a thread out of the group and to another group.

So I see two approaches:

1. Refactor the CPE such that it doesn't create a {{ThreadGroup}} anymore and track the threads in some different way.
2. Change Ruta such that the cache either doesn't spawn a time-based clean-up thread or override the thread factory with one that always tries creating the thread in some root thread group (i.e. not in the {{CPMThreadGroup}})

> RutaPatternCache prevents CPEEngine from terminating
> ----------------------------------------------------
>
>                 Key: UIMA-6399
>                 URL: https://issues.apache.org/jira/browse/UIMA-6399
>             Project: UIMA
>          Issue Type: Bug
>          Components: Ruta
>            Reporter: Richard Eckart de Castilho
>            Priority: Major
>         Attachments: Screenshot 2021-12-10 at 17.38.08.png
>
>
> The {{RutaPatternCache}} creates a Caffeine cache internally which spawns a cleanup worker thread. If this thread is spawed while Ruta is running in a CPE, then the thread is added to the CPE's thread group. When the CPE is done processing, it waits for all the worker threads in its group to terminate. Normally, these are only the reader thread, the processor threads, the consumer thread, and the thread-group destroyer thread. The extra thread added via Caffeine causes the thread-group destroyer to believe that there are still workers running and thus it will never terminate the CPEEngine. That means, the engines and resources used in the engine will never be GCed.
>  !Screenshot 2021-12-10 at 17.38.08.png|width=50%! 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)