Skip to content

Don't kill the test process during cleanup#40503

Merged
OneBlue merged 1 commit into
masterfrom
user/oneblue/job-cleanup
May 12, 2026
Merged

Don't kill the test process during cleanup#40503
OneBlue merged 1 commit into
masterfrom
user/oneblue/job-cleanup

Conversation

@OneBlue
Copy link
Copy Markdown
Collaborator

@OneBlue OneBlue commented May 11, 2026

Summary of the Pull Request

This change fixes the following warning when the tests complete:

Warning: TAEF: [HRESULT 0x800706BE] A failure occurred while cleanly shutting down the test host process. (The test host process was unexpectedly terminated with exit code 0x00000000 while preparing to be shut down. (An RPC call failed.))

See comment for details

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copilot AI review requested due to automatic review settings May 11, 2026 22:41
@OneBlue OneBlue requested a review from a team as a code owner May 11, 2026 22:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Prevents TAEF’s test host from being terminated during shutdown by avoiding closing a job object that has KILL_ON_JOB_CLOSE set.

Changes:

  • Removes the global wil::unique_handle job handle so it won’t be auto-closed during cleanup.
  • Creates a job object as a raw HANDLE and intentionally leaks it to keep the host alive through shutdown while still using KILL_ON_JOB_CLOSE.

Comment thread test/windows/Common.cpp
Comment on lines +1982 to +1990
// N.B. When the job object is closed, all processes associated with the job will be terminated.
// Because of that, we're purposefully leaking this job object so we don't kill the test process on cleanup.
auto job = CreateJobObjectW(nullptr, nullptr);
THROW_LAST_ERROR_IF(!job);

JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobInfo{};
jobInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
THROW_IF_WIN32_BOOL_FALSE(SetInformationJobObject(g_processJob.get(), JobObjectExtendedLimitInformation, &jobInfo, sizeof(jobInfo)));
THROW_IF_WIN32_BOOL_FALSE(AssignProcessToJobObject(g_processJob.get(), GetCurrentProcess()));
THROW_IF_WIN32_BOOL_FALSE(SetInformationJobObject(job, JobObjectExtendedLimitInformation, &jobInfo, sizeof(jobInfo)));
THROW_IF_WIN32_BOOL_FALSE(AssignProcessToJobObject(job, GetCurrentProcess()));
Comment thread test/windows/Common.cpp
@@ -70,7 +70,6 @@ std::wstring g_testDistroPath;
std::wstring g_testDataPath;
bool g_fastTestRun = false; // True when test.bat was invoked with -f
static wil::unique_mta_usage_cookie g_mtaCookie;
Comment thread test/windows/Common.cpp
Comment on lines +1982 to +1985
// N.B. When the job object is closed, all processes associated with the job will be terminated.
// Because of that, we're purposefully leaking this job object so we don't kill the test process on cleanup.
auto job = CreateJobObjectW(nullptr, nullptr);
THROW_LAST_ERROR_IF(!job);
@OneBlue OneBlue merged commit 04553ca into master May 12, 2026
15 checks passed
@OneBlue OneBlue deleted the user/oneblue/job-cleanup branch May 12, 2026 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants