[
https://issues.apache.org/jira/browse/TIKA-5040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18138083#comment-18138083
]
ASF GitHub Bot commented on TIKA-5040:
--------------------------------------
dpol1 commented on PR #3532:
URL: https://github.com/apache/tika/pull/3532#issuecomment-6636742757
For now I tried only on Linux, would help try in different OS..
> 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)