Skip to content

Use Windows subsystem for AccessControlTestApp to eliminate console handoff race - #7004

Draft
Kyaw Thant (kythant) wants to merge 1 commit into
mainfrom
user/kythant/accesscontrol-test-subsystem
Draft

Kyaw Thant (kythant) wants to merge 1 commit into
mainfrom
user/kythant/accesscontrol-test-subsystem

Conversation

@kythant

Copy link
Copy Markdown
Contributor

Description

Fixes intermittent timeouts in Test::AccessControl::APITests (win32_event.wait(10000) and MethodUninit handle_wait failures) on Windows 11.

Root Cause

AccessControlTestApp.exe is a headless test helper that opens AccessControlTest_Event, signals it, and exits, yet it was built with /SUBSYSTEM:CONSOLE. On Windows 11 with Default Terminal delegation enabled, launching consecutive test methods (FlatAPITest, WinRTStringTest, WinRTBytesTest) triggers conhost.exe -> OpenConsole.exe -> WindowsTerminal.exe activation and teardown back-to-back:

  1. Cold-starting WindowsTerminal.exe adds multi-second startup overhead on the first test.
  2. When the next test launches AccessControlTestApp.exe milliseconds after the previous instance exits, OpenConsole.exe can hand off to the shutting-down WindowsTerminal.exe instance. When that terminal exits mid-handoff, conhost.exe exits with ERROR_BROKEN_PIPE, KernelBase!DllMain fails console initialization (STATUS_DLL_INIT_FAILED /

…andoff race

AccessControlTestApp is a headless test helper that opens AccessControlTest_Event,
signals it, and exits, yet it was built with /SUBSYSTEM:CONSOLE. On Windows 11
with Default Terminal delegation enabled, launching consecutive test methods
triggers conhost.exe -> OpenConsole.exe -> WindowsTerminal.exe activation and
teardown back-to-back. When a subsequent test launches while the previous
WindowsTerminal.exe instance is shutting down, the handoff can fail with
ERROR_BROKEN_PIPE during KernelBase!DllMain console initialization
(STATUS_DLL_INIT_FAILED / 0xC0000142), hanging the helper process before main()
is ever reached and timing out both win32_event.wait and MethodUninit.

Changes:
- Switch AccessControlTestApp to /SUBSYSTEM:WINDOWS with wWinMain and
  OutputDebugStringW so no console host or terminal handoff occurs.
- Create AccessControlTest_Event before launching AccessControlTestApp in
  AccessControlTests::APITests to remove the startup polling race.
- Open the child process handle with PROCESS_TERMINATE and terminate hung
  processes in test cleanup so package removal does not stall on failure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant