test(relinker): launch the GUI startup fixtures without Windows Error Reporting #2227

Merged
rmz-24 merged 1 commit from upstream-pr/2227 into main 2026-10-09 22:06:52 +00:00
rmz-24 commented 2026-10-09 12:24:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T12:24:56Z.


What

windows_import_modules fails intermittently on Windows under a parallel ctest run, at about 31.6 s:

  File "test_windows_import_modules.py", line 291, in main
    run_status = shell_execute_exit_code(output)
  File "test_windows_import_modules.py", line 159, in shell_execute_exit_code
    raise TimeoutError('ShellExecuteExW child did not exit')
...
PermissionError: [WinError 5] Access is denied: '...\missing-symbol-gui\app0\prx\a.prx.guest.prx'

The same failure is mentioned in #2079 ("timed out waiting for the unrelated windows_import_modules GUI child, followed by a temporary-file cleanup PermissionError") and #2020 (the cleanup PermissionError on a .prx.guest.prx the test has just run).

Cause: the two --windows-gui fixtures (#1153) were started with ShellExecuteExW. A process the shell starts gets the default error mode, so the RaiseException with which the entry stub reports 0xc0000139/0xc0000135 goes to Windows Error Reporting as an APPCRASH. The Application log shows one Windows Error Reporting event per launch (P1: output.exe, P4: KERNELBASE.dll, P7: c0000139). Collecting the report delays the child's exit: about 2 s per launch here, 10.9 s once in 60 launches, and past the test's 30 s wait under load. WerFault also keeps the image open, which is the PermissionError at cleanup.

The fixtures now start through CreateProcessW with STARTF_USESTDHANDLES and no standard handles, and with SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX added to the test's error mode, which the child inherits. The condition #1153 tests is unchanged: the stub's diagnostic has no handle to write to, and the raised status must still be the exit status. Nothing outside the test changes; a title started from Explorer still reports through the system as before.

Tested

Windows 11 Pro 25H2 (10.0.26200.9457), MinGW-w64 GCC 15.2.0 (WinLibs r7), Python 3.14, Release, full build on main d70b8998.

  • Before: in repeated full ctest -j8 runs the test failed 3 times in about 25, always as above. Launching the GUI missing-symbol fixture 60 times through ShellExecuteExW took 1.9-2.6 s per launch (once 10.9 s), and each launch logged a WER event. Through a handle-less CreateProcessW the same fixture exits in under 35 ms with 0xc0000139 (0xc0000135 for the missing-module one).
  • After: windows_import_modules takes 1.24 s alone (5.1 s before) and 1.3-1.9 s in six full ctest -j8 runs, 510/510 each. No WER event is logged during the test.
  • tools/check_conventions.py --base upstream/main passes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4800369965 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2227). Originally posted by [rmz-24](https://github.com/rmz-24) on 2026-10-09T12:24:56Z. --- ### What `windows_import_modules` fails intermittently on Windows under a parallel ctest run, at about 31.6 s: ``` File "test_windows_import_modules.py", line 291, in main run_status = shell_execute_exit_code(output) File "test_windows_import_modules.py", line 159, in shell_execute_exit_code raise TimeoutError('ShellExecuteExW child did not exit') ... PermissionError: [WinError 5] Access is denied: '...\missing-symbol-gui\app0\prx\a.prx.guest.prx' ``` The same failure is mentioned in #2079 ("timed out waiting for the unrelated windows_import_modules GUI child, followed by a temporary-file cleanup PermissionError") and #2020 (the cleanup `PermissionError` on a `.prx.guest.prx` the test has just run). Cause: the two `--windows-gui` fixtures (#1153) were started with `ShellExecuteExW`. A process the shell starts gets the default error mode, so the `RaiseException` with which the entry stub reports `0xc0000139`/`0xc0000135` goes to Windows Error Reporting as an `APPCRASH`. The Application log shows one `Windows Error Reporting` event per launch (`P1: output.exe`, `P4: KERNELBASE.dll`, `P7: c0000139`). Collecting the report delays the child's exit: about 2 s per launch here, 10.9 s once in 60 launches, and past the test's 30 s wait under load. WerFault also keeps the image open, which is the `PermissionError` at cleanup. The fixtures now start through `CreateProcessW` with `STARTF_USESTDHANDLES` and no standard handles, and with `SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX` added to the test's error mode, which the child inherits. The condition #1153 tests is unchanged: the stub's diagnostic has no handle to write to, and the raised status must still be the exit status. Nothing outside the test changes; a title started from Explorer still reports through the system as before. ### Tested Windows 11 Pro 25H2 (10.0.26200.9457), MinGW-w64 GCC 15.2.0 (WinLibs r7), Python 3.14, Release, full build on `main` d70b8998. - Before: in repeated full `ctest -j8` runs the test failed 3 times in about 25, always as above. Launching the GUI missing-symbol fixture 60 times through `ShellExecuteExW` took 1.9-2.6 s per launch (once 10.9 s), and each launch logged a WER event. Through a handle-less `CreateProcessW` the same fixture exits in under 35 ms with `0xc0000139` (`0xc0000135` for the missing-module one). - After: `windows_import_modules` takes 1.24 s alone (5.1 s before) and 1.3-1.9 s in six full `ctest -j8` runs, 510/510 each. No WER event is logged during the test. - `tools/check_conventions.py --base upstream/main` passes. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!2227
No description provided.