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

Hudson commented on TIKA-5040:
------------------------------

UNSTABLE: Integrated in Jenkins build Tika ยป tika-main-jdk17 #1775 (See 
[https://ci-builds.apache.org/job/Tika/job/tika-main-jdk17/1775/])
TIKA-5040: kill descendant processes with the forked server and in 
ProcessUtils.execute (#3532) (github: 
[https://github.com/apache/tika/commit/339693b6cf22ddcc868294d0f597b946c967b67c])
* (edit) CHANGES.txt
* (add) tika-core/src/test/java/org/apache/tika/utils/ProcessTestHelper.java
* (add) 
tika-pipes/tika-pipes-integration-tests/src/test/java/org/apache/tika/pipes/core/ExternalProcessCleanupTest.java
* (edit) 
tika-pipes/tika-pipes-core/src/main/java/org/apache/tika/pipes/core/PerClientServerManager.java
* (edit) tika-core/src/test/java/org/apache/tika/utils/ProcessUtilsTest.java
* (add) 
tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-external-sleep.json
* (edit) 
tika-pipes/tika-pipes-integration-tests/src/test/java/org/apache/tika/pipes/core/PluginsTestHelper.java
* (edit) tika-core/src/main/java/org/apache/tika/utils/ProcessUtils.java
* (edit) 
tika-pipes/tika-pipes-core/src/main/java/org/apache/tika/pipes/core/SharedServerManager.java


> Orphaned external processes after a forked server is killed or ProcessUtils 
> stops waiting
> -----------------------------------------------------------------------------------------
>
>                 Key: TIKA-5040
>                 URL: https://issues.apache.org/jira/browse/TIKA-5040
>             Project: Tika
>          Issue Type: Bug
>          Components: tika-core, tika-pipes
>    Affects Versions: 4.2.0
>            Reporter: Davide Polato
>            Priority: Minor
>             Fix For: 4.3.0
>
>
> In looking at how to stop a running parse (TIKA-4795), I found that killing a 
> forked pipes server leaves its external processes running.
> PerClientServerManager and SharedServerManager kill the server with 
> destroyForcibly, which is SIGKILL on Linux. ProcessUtils kills the processes 
> it started in execute()'s finally block or in a shutdown hook. SIGKILL ends 
> the JVM before either runs.
> When the server exits on its own, the hook runs, but it kills only the direct 
> process. With {{sh -c 'sleep 300; true'}}, the sleep keeps running. The 
> timeout and interrupt paths of ProcessUtils.execute have the same gap.
> TIKA-3103 shows what this costs: orphaned tesseract processes at 100% CPU for 
> over ten minutes.
> I have tests that reproduce each case on main. I'll open a PR that also kills 
> the descendants, via ProcessHandle.descendants(), in both server managers and 
> wherever ProcessUtils kills a process.
> TesseractOCRParser uses a separate hook in AbstractExternalProcessParser. I'd 
> leave that for a follow-up, unless you'd rather have it in this PR?



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to