cpu_package_ordinal_exe and cpu_startup_exe return from their entry point and can linger ~30 s (exit 0x0) under load, as in #281 #1368

Closed
opened 2026-11-24 09:42:04 +00:00 by Maxim-Root · 1 comment
Maxim-Root commented 2026-11-24 09:42:04 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Maxim-Root on 2026-11-24T09:42:04Z.


Commit or build

e1316e1c (main), dev preset (Debug), clean build.

Reproduction

The CTest symptom shows up under a parallel run:

ctest --preset dev --no-tests=error -R '^cpu_native_' -j 16

In repeated runs at c4966c64/f2082414, cpu_native_package_ordinal_startup failed in most runs and cpu_native_startup in some. In every case subprocess.TimeoutExpired ... cpu_package_ordinal_exe.exe / cpu_startup_exe.exe timed out after 30 seconds. Both tests pass alone: 0.45 s and 0.70 s.

A direct launch loop separates it from CTest. Sixteen Python processes each launch one fixture serially through tests/cpu/exe_process.launch() with a 40 s deadline. Each launch uses its own temporary directory with the EXE and its DLLs. Sixteen busy-loop processes keep the CPU saturated (Ryzen 7 7800X3D, 16 logical CPUs).

Expected behavior

Each launch ends promptly with the entry's result as the exit code: 0xd for cpu_package_ordinal_exe, 0x103020e for cpu_startup_exe.

Observed behavior

Fixture Launches Slow (> 5 s) What the slow launches show
cpu_package_ordinal_exe 7,500 78 almost all: process ends by itself after 30.0–30.1 s with exit 0x0; one still alive at 40 s: entry thread ended with 13 (0xd, correct), one other live thread
cpu_startup_exe 2,400 9 exit 0x0 after ~30.0 s, or still alive at 40 s: entry thread ended with 0x103020e (correct), one other live thread

Without the extra CPU load, 640 launches of cpu_package_ordinal_exe (16 parallel) all ended with 0xd and none was slow.

This is the #281 signature that #589 fixed for the exe_start fixtures. Both EXEs are linked with /NODEFAULTLIB and a custom /ENTRY (ordinal_exe_entry, exe_entry). The entry returns its value without terminating the process:

  • tests/cpu/package_ordinal_exe.cpp: return static_cast<std::uint32_t>(result);
  • tests/cpu/startup_exe.cpp: return b_value() | ...; (it calls ExitProcess only on its error paths)

When the entry thread returns, nothing ends the process while an idle loader or thread-pool worker is alive. In the #589 measurement that worker's code 0 became the exit status after about 30 s. These fixtures were added after #589 and do not go through the native_startup / finish_exe wrapper that the other EXE fixtures use.

As in #589, the identity of the remaining thread is inferred, not proven. It is the only live thread after the entry thread ended with the correct value. I did not resolve its start address.

Related: #1173 runs the full suites with --parallel 4 and marks only cpu_native_worker_alive as RUN_SERIAL. These two tests would stay exposed there.

Proposed change (one PR). End both fixtures through the existing termination path. The native process exits with the entry's value, and the pe_map run still gets that value back from pe_map_run. The existing expected values and controls stay unchanged. Add a check that the native launch ends with the entry value, not 0x0 after a delay. I will link the PR here.

Environment

Windows 11 Pro build 26300.9818, Visual Studio 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100.0, CMake 3.31.6 (VS bundled), Python 3.12.10, AMD Ryzen 7 7800X3D (16 logical CPUs), 32 GB.

Checklist

  • I reproduced this on a source-built input.
  • I did not include game files, dumps, distribution links or credentials.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6578931938 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1375). Originally posted by [Maxim-Root](https://github.com/Maxim-Root) on 2026-11-24T09:42:04Z. --- ### Commit or build `e1316e1c` (`main`), `dev` preset (Debug), clean build. ### Reproduction The CTest symptom shows up under a parallel run: ```powershell ctest --preset dev --no-tests=error -R '^cpu_native_' -j 16 ``` In repeated runs at `c4966c64`/`f2082414`, `cpu_native_package_ordinal_startup` failed in most runs and `cpu_native_startup` in some. In every case `subprocess.TimeoutExpired ... cpu_package_ordinal_exe.exe / cpu_startup_exe.exe timed out after 30 seconds`. Both tests pass alone: 0.45 s and 0.70 s. A direct launch loop separates it from CTest. Sixteen Python processes each launch one fixture serially through `tests/cpu/exe_process.launch()` with a 40 s deadline. Each launch uses its own temporary directory with the EXE and its DLLs. Sixteen busy-loop processes keep the CPU saturated (Ryzen 7 7800X3D, 16 logical CPUs). ### Expected behavior Each launch ends promptly with the entry's result as the exit code: `0xd` for `cpu_package_ordinal_exe`, `0x103020e` for `cpu_startup_exe`. ### Observed behavior | Fixture | Launches | Slow (> 5 s) | What the slow launches show | |---|---:|---:|---| | `cpu_package_ordinal_exe` | 7,500 | 78 | almost all: process ends by itself after 30.0–30.1 s with exit **`0x0`**; one still alive at 40 s: entry thread ended with `13` (`0xd`, correct), one other live thread | | `cpu_startup_exe` | 2,400 | 9 | exit `0x0` after ~30.0 s, or still alive at 40 s: entry thread ended with `0x103020e` (correct), one other live thread | Without the extra CPU load, 640 launches of `cpu_package_ordinal_exe` (16 parallel) all ended with `0xd` and none was slow. This is the #281 signature that #589 fixed for the `exe_start` fixtures. Both EXEs are linked with `/NODEFAULTLIB` and a custom `/ENTRY` (`ordinal_exe_entry`, `exe_entry`). The entry returns its value without terminating the process: - `tests/cpu/package_ordinal_exe.cpp`: `return static_cast<std::uint32_t>(result);` - `tests/cpu/startup_exe.cpp`: `return b_value() | ...;` (it calls `ExitProcess` only on its error paths) When the entry thread returns, nothing ends the process while an idle loader or thread-pool worker is alive. In the #589 measurement that worker's code 0 became the exit status after about 30 s. These fixtures were added after #589 and do not go through the `native_startup` / `finish_exe` wrapper that the other EXE fixtures use. As in #589, the identity of the remaining thread is inferred, not proven. It is the only live thread after the entry thread ended with the correct value. I did not resolve its start address. Related: #1173 runs the full suites with `--parallel 4` and marks only `cpu_native_worker_alive` as `RUN_SERIAL`. These two tests would stay exposed there. **Proposed change (one PR).** End both fixtures through the existing termination path. The native process exits with the entry's value, and the `pe_map` run still gets that value back from `pe_map_run`. The existing expected values and controls stay unchanged. Add a check that the native launch ends with the entry value, not `0x0` after a delay. I will link the PR here. ### Environment Windows 11 Pro build 26300.9818, Visual Studio 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100.0, CMake 3.31.6 (VS bundled), Python 3.12.10, AMD Ryzen 7 7800X3D (16 logical CPUs), 32 GB. ### Checklist - [x] I reproduced this on a source-built input. - [x] I did not include game files, dumps, distribution links or credentials. AI-assisted (Claude Code).
R0Y00 commented 2026-11-24 10:02:42 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T09:51:14Z.


Please take this as a focused follow-up to #589. Reuse the existing termination wrapper for these two source-built fixtures so native launch preserves their exact exit values and mapped launch still returns those values to the caller. Keep the existing tests and timeouts. In the PR, include a bounded loaded-host comparison and report both the process exit code and any run that exceeds the deadline.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7127978868 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1375#issuecomment-7127978868). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T09:51:14Z. --- Please take this as a focused follow-up to #589. Reuse the existing termination wrapper for these two source-built fixtures so native launch preserves their exact exit values and mapped launch still returns those values to the caller. Keep the existing tests and timeouts. In the PR, include a bounded loaded-host comparison and report both the process exit code and any run that exceeds the deadline.
Sign in to join this conversation.
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
R0Y00/Xbox2Windows#1368
No description provided.