Skip to content

#5994 Fix llprocess waiting too long on kill#6019

Merged
akleshchev merged 2 commits into
developfrom
andreyk/viewer-5995
Jul 19, 2026
Merged

#5994 Fix llprocess waiting too long on kill#6019
akleshchev merged 2 commits into
developfrom
andreyk/viewer-5995

Conversation

@akleshchev

Copy link
Copy Markdown
Contributor

Noticed some extra delays when media was being killed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces main-thread stalls and redundant termination work when an LLProcess is being killed/cleaned up, which should address the reported extra delays when media processes are terminated.

Changes:

  • Add a mKillCalled flag to avoid repeating termination work in ~LLProcess() after an explicit kill().
  • Reduce/avoid blocking waits on Windows by using GetExitCodeProcess() instead of WaitForSingleObject(..., 100) in tick() and shortening the destructor wait.
  • Adjust kill() to mark the process as “kill requested” and return success once the kill signal/request is issued (without waiting for state transition).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
indra/llcommon/llprocess.h Adds mKillCalled state to track explicit kill requests.
indra/llcommon/llprocess.cpp Removes/shortens blocking waits on Windows; uses mKillCalled to skip redundant destructor termination after kill().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread indra/llcommon/llprocess.cpp Outdated
Comment thread indra/llcommon/llprocess.cpp Outdated
Comment thread indra/llcommon/llprocess.cpp Outdated
@akleshchev
akleshchev force-pushed the andreyk/viewer-5995 branch from c22248b to 1884f5e Compare July 17, 2026 17:40
@akleshchev

Copy link
Copy Markdown
Contributor Author

@copilot, please add a unit test into llprocess_test.cpp that unsures tick() takes no more than an ms and a similar test for destruction.

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@copilot, please add a unit test into llprocess_test.cpp that unsures tick() takes no more than an ms and a similar test for destruction.

Added two regression tests in commit Add timing tests for tick() and destructor after kill():

  • test 34 (tick() completes quickly after kill()): launches a long-sleeping process, kills it, waits 100 ms for OS-level termination, then times a single mainloop tick and asserts it completes in < 75 ms. This covers the code path that previously called WaitForSingleObject(..., 100) in tick() on Windows.

  • test 35 (LLProcess destructor completes quickly after kill()): launches a long-sleeping process, calls kill() (which sets mKillCalled = true), then times the destructor and asserts it completes in < 75 ms. Since mKillCalled causes the destructor to skip the termination/wait block entirely, this should be near-instantaneous.

Both thresholds (75 ms) are well below the old 100 ms blocking wait, providing a clear regression guard while remaining robust on loaded CI systems.

@github-actions

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


1 out of 2 committers have signed the CLA.
✅ (akleshchev)[https://github.com/akleshchev]
❌ @Copilot
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@akleshchev
akleshchev merged commit 331c3c7 into develop Jul 19, 2026
13 of 15 checks passed
@akleshchev
akleshchev deleted the andreyk/viewer-5995 branch July 19, 2026 07:36
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace apr in llprocess with boost::process

4 participants