cpu: CRT-free EXE intermittently hangs after native entry returns #277
Closed
opened 2026-11-21 20:31:44 +00:00 by RonLogic
·
28 comments
No Branch/Tag specified
main
codex/indirect-large-backed-views
codex/word3-preflight-check
codex/vertex-table-two-records
codex/live-index-alias
codex/copied-vertex-buffer-srv
codex/windows-stage-test-output
codex/preserve-live-srv-retirement
codex/share-render-target-tracking
codex/sgd5-negative-offset-fixture
coverage-dashboard
codex/mesh-loose-root
codex/mesh86-cache-padding
codex/xmem-scatter-preflight
codex/mesh-depth-ps
codex/indirect-dispatch-refresh
codex/compute-container-index
codex/startup-compute-formatted-load
codex/compute-indirect-producer
codex/compute-atomic-soffset
codex/mesh-dual-handoff
codex/startup-run-sh-watcher-control
codex/queue31-page-alias
codex/indexed-indirect-compute-root
codex/typed-buffer-view-metadata
codex/translated-indexed-address-alias
codex/fixed-mesh-create-result
codex/xmem-section-lease
codex/startup-slot86-mesh-cache
codex/restore-mesh-barrier-iteration
codex/translated-indirect-upload-index
codex/xapu-completion-opt-in
codex/translated-indexed-rect
codex/translated-indexed-indirect
codex/startup-mesh-lds-integration
codex/startup-console-ms24
codex/startup-slot57-mesh-request
codex/indirect-copy-provenance
codex/present-color-producer-trace
codex/compute-dispatch-binding-trace
codex/translated-indirect-table-buffers
codex/indirect-copy-provenance-base
codex/mix-half-literal-source
codex/translated-indirect-draw
codex/xmem-scatter-diagnostics
codex/slot148-recording-upload
codex/slot70-loading-art-verified
codex/command-list-upload-arena
codex/recover-failed-command-list
codex/startup-heap-timing-notes
codex/align-audio-input-timeline
codex/synthetic-depth-export-control
codex/startup-texture1d-on-windows
codex/1629-packed-position-fixture
codex/cpu-srv-refresh
codex/stream-root-srv-draw
codex/audio-mixer-timer
codex/startup-reload-published-shader
codex/priority-integrate-1284
codex/guest-sixteen-page-record
codex/aot-placed-dxr-batch
codex/guest-directory-selection
codex/gamesave-enumerate-read
codex/readme-archive-to-pixels
codex/pe-placed-view-draw
codex/archive-directory-gpu
codex/slot133-dxr-build
codex/materialize-placed-vertex-view
codex/dstorage-directory-offsets
codex/xg-nine-bc-copy
codex/xg-slot10-bc64-arrays
codex/dxr-guest-address-readback
codex/gpu-va-high-bits
codex/clarify-diagnostic-startup-scope
codex/xg-six-levels
codex/typed-derived-blend
codex/english-legal-text-progress
codex/address-bc-4ks
codex/dstorage-bounded-file-read
codex/wide-srv-offsets-menu
codex/startup-memory-srv
codex/bound-view-tail
codex/language-selector-readback
codex/setup-menu-progress
codex/cpu-plane-refresh
codex/startup-ubyte-vertex
codex/presenter-window-selection
codex/startup-uniform-buffer-lane
codex/intro-loop-timing
codex/static-clzero-loops
codex/document-rtx-intro
codex/startup-insertq
codex/nv12-startup-texture
codex/stream-stage-draw
codex/startup-null-uav-format
codex/startup-draw-capture
codex/shorten-windows-checks
codex/dstorage-rfc1950
codex/startup-dump-fence
codex/pr1135-review-base
codex/startup-stream-requests
codex/startup-chroma-view
codex/readme-graphics-pipeline-streams
codex/static-crt-free-tls
codex/arc-140t-rtx-5080-laptop-gpu-reports
codex/main-startup-progress-entry
codex/signed-dxil-catalogue
codex/reloc-free-preferred-base
codex/quad-dpp-bit-mask
codex/raw-srv-bounds
codex/rx9070-31044-hardware-report
codex/gpu-page-source-provenance
codex/runtime-placeholder-interior
codex/gpu-copy-queue-tile-order
codex/pe-pin-external-providers
codex/xmem-placeholder-reservations
codex/xmem-shared-physical-pages
codex/pe-package-startup
codex/xmem-tools-memory-query
codex/cpu-stack-output-import
codex/pe-load-security-cookie
codex/record-three-bvh-retests
codex/cpu-rbp-frame-anchor
codex/xmem-default-startup
codex/record-rtx-3050-ti-9597
codex/docs-readme-start-here
codex/check-compute-mad24-truncation
codex/docs-discord-community
codex/bound-rcx-branch-mutants
codex/rtx5060ti-bvh-62114
codex/837-neutral-readme-disclaimer
codex/record-rtx-3070-ti
codex/title-neutral-public-wording
codex/exe-shadow-frame-submissions
codex/exe-shadow-runtime-chain
codex/readme-polish
codex/gpu-coverage-nov23
codex/spirv-minlod
codex/shadow-shim-device
codex/exe-two-shadow-frames
codex/shim-dispatch-cleanup
codex/fix-spirv-cache-probe
codex/sampler-use
codex/ballot-bit-extract
codex/packed-fma-release
codex/cpu-packed-fma-o2
codex/publish-coverage-dashboard
codex/mesh-cbv-binding-order
codex/spirv-window-fixture
codex/ps-e32-float-uint
codex/ps-cbuffer-reads
codex/fixed-profile-rescan
codex/shim-compute-integration
codex/readme-visible-coverage
codex/readme-research-navigation
codex/integrate-pr-256
codex/indexed-mesh
codex/sampled-coverage
codex/first-ms
codex/dual-ps
codex/ps-attribute
codex/compute-first
codex/ps-export
codex/readme-research-status
codex/ps-layout
codex/blast-window
codex/chart-caption
codex/reviewer-roles
codex/blast-aot
codex/archive-program
codex/crc-stream-program
codex/exe-image-data-chain
codex/local-cpu-fixture-coverage
codex/exe-bound-frame-chain
codex/exe-mapped-comparison
codex/contribution-dependencies
codex/exe-entry-aot
codex/bink-frame-heap-integration
docs/hardware-seven-reports
codex/bink-custom-heap
codex/bink-heap-callers
codex/discussions-entry-points
codex/gpu-community-batch-64
codex/ffx-scratch-writers
codex/generic-project-documentation
codex/ffx-dispatch-rcas
codex/four-windows-gpu-reports
codex/title-neutral-project-wording
codex/community-coverage-provenance
codex/rcas-packed-texels
codex/community-gpu-retests
codex/community-build-and-gpu-reports
codex/ffx-provider-loop
codex/ffx-recurrent-views
codex/ffx-recurrent-resource
codex/amd-wave64-reports
codex/ffx-backend-slots
codex/upscaler-device-init
codex/ffx-context-lifecycle
codex/ffx-version-query
codex/ffx-provider-contract
codex/typed-object-callback
codex/cpu-ordinal-import
codex/chained-cpu-ranges
codex/cpu-import-call
codex/cpu-direct-call
codex/cpu-leaf-aot
codex/community-project-status
codex/script-state-path-replay
codex/script-state-evidence
codex/bc7-resident-tail
codex/bcpack-mip-tail
codex/bc7-texture-draw
codex/asset-ranges
codex/pixel-constants
codex/pixel-aot
codex/pre-exe-workloads
codex/root-signature-device-coverage
engineering/packed-bvh-leaves
engineering/bvh-build-and-update
engineering/intake-root-roundtrip
community/gpu-check-release
community/english-contributor-entry
gpu-check-v0.1.0
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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#277
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-21T20:31:44Z.
Summary
A CRT-free source-built CPU EXE intermittently does not terminate after processing a one-byte selector on Windows. The timeout reproduces outside CTest and without the
pe_maploader. This was found during validation of #256, but the stalled program is the unmodified native fixturecpu_exe_original.exe, so there is no evidence that the generated-C++ symbol-validation change caused the hang.Reproduction and observed results
cmake --preset dev && cmake --build --preset dev: 309/309 build steps successful.ctest --preset dev --no-tests=error -R '^cpu_' --output-on-failure: 33/34 passed;cpu_native_exe_chaintimed out after 15 s, whilecpu_native_exe_two_providerspassed.ctest --preset dev --no-tests=error -R '^cpu_native_exe_chain$' -V: passed in 0.37 s for both selectors. Running with--repeat until-fail:5: immediately timed out after 15 s.subprocess.run([path/to/cpu_exe_original.exe], input=bytes([selector]), capture_output=True, timeout=5)with alternating selectors: nine successful launches (about 4–7 ms each), followed byTimeoutExpiredat launch 10, selector 1. Another attempt timed out on the very first launch, selector 0.0x60d, 8 stdout bytes and 16 stderr bytes. The issue is intermittent, not reproducibly specific to one I/O redirection mode.Debugger observation
On a stalled independent launch, Visual Studio attached to
cpu_exe_original.exe(PID 2168). After loading Windows symbols, only one live thread remained, TID 26040. Its entire visible stack was:No frame from
native_entrywas on that thread's stack. This strongly suggests the original process-entry thread returned while a Windows thread-pool worker stayed alive; it is not yet definitive proof of the thread-creation sequence.Suspected cause / code locations
tests/cpu/exe_entry.asm:native_entryends withadd rsp, 72; ret.CMakeLists.txt: the native fixture is linked with/ENTRY:native_entry /NODEFAULTLIB /INCREMENTAL:NO, without the normal CRT startup path.retwithExitProcess:pe_map_runalso calls the mapped PE entry point in-process and relies on its return value and cleanup. The AOT translator also requires a bounded return-based entry profile.Suggested fix and acceptance criteria
pe_mapand the AOT experiment (or implement an equivalent tested separation).cpu_aot_exe_entry,cpu_native_exe_chain,cpu_native_exe_two_providers, and full^cpu_CTest suite.Windows behavior reference: https://learn.microsoft.com/en-us/windows/win32/procthread/terminating-a-process
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-21T20:46:37Z.
A data point from a different environment: the hang did not reproduce here.
cpu_exe_original.exeatc832696. Ninja reported the target up to date, and its sources have not changed sincec04e65a.subprocess.run([exe], input=bytes([selector]), capture_output=True, timeout=...)and alternating selectors 0 and 1.0x60d) 150 times, and selector 1 with 87 150 times.The EXE imports
cpu_exe_io.dllandcpu_import_provider.dll. Each of them importsVCRUNTIME140D.dll,ucrtbased.dllandKERNEL32.dll. The lingering worker in the report may therefore depend on how that machine's loader handles these dependencies, but I have not measured that. Since the current fixture terminates reliably here, this machine cannot show whether a fix works.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T20:56:20Z.
Please keep the return-based entry while we narrow down the native timeout. The original reproduction launches the EXE without CTest or
pe_map. The 2,300 successful launches on a second machine give us an environment comparison; this issue stays open.On the reproducing machine, please run a bounded comparison and summarize one normal launch and one timeout. Include the Windows build and the build IDs or hashes of the EXE and both imported DLLs. Windows process/thread events for the entry thread and worker (creation, exit and, if available, creation stack) would help. At timeout, before terminating the child, check whether its process handle is signaled. Record the bytes already received and EOF status separately for stdout and stderr. A text summary is sufficient.
If the entry thread has exited but a live worker keeps the process running, we can evaluate a native startup wrapper with a deliberately live worker as a deterministic control. If the process handle is already signaled, the next question is which process retains a pipe writer. Keep #249’s same-image comparison and
pe_map_runreturning to its caller. Please avoid addingExitProcessto the shared entry or masking the timeout with delays or retries.Imported from R0Y00/Xbox2Windows. Originally posted by sof9816 on 2026-11-21T21:57:44Z.
I captured the requested normal/timeout comparison on a reproducing machine. The binaries were built from
c832696with MSVC19.44.35229. Windows 11 Pro x6426200.9711, Python3.13.3. They ran standalone with pipes and below-normal process priority. Both compared launches used selector00. The timeout was the third launch.WAIT_OBJECT_0, exit0x60dWAIT_TIMEOUTbefore and after enumerating threads,STILL_ACTIVE0x60d, lifetime 65 ms0x60d, lifetime 63 ms1103000000000000, EOF0303000001000000fdffffff00000000, EOFThe initial thread had exited by the time of the timeout while the process was still alive. The capture records thread creation and exit times. I did not capture start routines or creation stacks.
cpu_exe_original.exe3d36747356031384de2a51898df38fe2891f080923a9d267d6a7513dbd4a0365cpu_exe_io.dllcf4eceb3a47905c800d41e49475e1c8640188d36ccfbc590943f3355575f72a1cpu_import_provider.dll15ab238a128a72d49b1cac763f60cecc448d6f39b7392c6cf03cdf3ac016f676AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-21T21:26:44Z.
A third environment that does not reproduce the hang, measured on 2026-11-21.
Environment
fc0f5d5.tests/cpu/andCMakeLists.txtare identical betweenfc0f5d5andd311159(GitHub compare returns no changed files), so this is the same fixture used in the report above and in Leyukaka's runThe three binaries under test:
cpu_exe_original.exe2f6006e90755ac15cc2e22b17ed5b432d5d0d77b02abdc3d2d38db03d6d0b79ecpu_exe_io.dll916276620eef7a3289c25ac32bdeecfea37d91b33b43a089bc4c4f3793734c09cpu_import_provider.dll102fb2c50374499f253f860945389d37094ec0b7596bbe308fef072b4c7cc214Runs
All launches use
subprocess.Popenwithstdin=PIPE,stdout=PIPE,stderr=PIPEandcommunicate(bytes([selector])), alternating selector 0 and 1.ctest --repeat until-fail:20 -R '^cpu_native_exe_chain$'The slowest launch in the parallel run took 125 ms. Exit codes were the usual 1549 (
0x60d) for selector 0 and 87 for selector 1 on every terminated launch.What this may add, and what it does not
This run adds a third non-reproducing environment, with a documented launch pattern and binary hashes, on the same fixture as the report above. It does not identify a cause.
An earlier version of this comment suggested the toolchain version as the dividing factor: the reporter's MSVC 19.52 against the 14.44 used by the two non-reproducing environments. The report just above from a reproducing machine built with 19.44 settles that — 19.44 is the same toolset family as 14.44, so the hypothesis does not hold and I am withdrawing it. The difference between the environments is still unidentified.
Harness
The probe records what you asked for when a launch times out, before terminating the child:
WaitForSingleObject(process._handle, 0), to report whether the process object is already signaledIt fired nowhere here. It is a roughly 90-line standard-library script. I can send it as a PR under
tests/tools/or paste it in this issue, whichever you prefer.Deterministic control
If the wrapper you mentioned is still the way you want to narrow the mechanism, a native startup control that deliberately keeps a worker alive past the entry thread's return, I can build and measure it on this machine. Say the word and I will open a PR that only adds the control, without touching the shared entry.
AI-assisted
Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-21T23:15:46Z.
I reproduced the native timeout on the original Windows machine, independently of CTest and
pe_map. Windows 11 x64 build26300.9974. The probe launches the source-built fixture with one byte on stdin, closes stdin, reads stdout and stderr independently, and snapshots the process and thread handles before cleanup. The second bounded run completed 62 launches and captured one timeout on launch 63. The comparison below uses selector00and the same binaries.0x60dSTILL_ACTIVE0x60d, lifetime 107.1 ms0x60d, lifetime 112.5 ms1103000000000000, EOF0303000001000000fdffffff00000000, EOFSHA-256 values:
cpu_exe_original.exe:42243aa6221f6591f146be53deb924d50af8cbf8ffd3c20e34c981f04b307d46cpu_exe_io.dll:7c7762d96bb37cb307f331b306688390e5f0b37b6cab889a9608fe0f90f07355cpu_import_provider.dll:73b2914aa538fa116fffe16a977b4ddfadd92f2ede236bcb5f0e953a8eaec410This independently confirms @sof9816’s process-lifetime result. The initial thread had returned successfully while the process and another thread remained alive. I obtained thread creation and exit times, but did not capture the remaining thread’s start routine or creation stack in this run. The shared return-based entry and
pe_map_runwere unchanged.Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-21T23:16:21Z.
Another environment where the fixture does not hang (2,200 launches, 0 timeouts), plus four small deterministic controls on how a returning CRT-free entry interacts with thread-pool workers. Two of the controls reproduce the reported end state (entry thread gone, a
TppWorkerThreadkeeping the process alive) without the fixture.Environment
b860dd5. The fixture sources (exe_entry.asm,exe_io.cpp,import_provider.cpp) and their CMake targets are unchanged sincec832696. Onlycpu_exe_original,cpu_exe_ioandcpu_import_providerwere built from sourcecpu_exe_original.exe21d1404406821a2cb453bc2c662a8d8b4f1daec80bf3e162a04aa12f70f146adcpu_exe_io.dll62560db186c3e201ba168849456d487708657951dc3fb83d8a168e000cfc658fcpu_import_provider.dlld06abe3d2ad4005d4a4983e39304f6fc2d080be9da7e3caa3fb9f341a584b8faFixture runs
subprocess.Popenwith three pipes, one selector byte written then stdin closed, stdout and stderr drained by separate reader threads, selectors alternating 0/1. On timeout the probe would record, before terminating:WaitForSingleObject(process, 0), bytes and EOF per stream, and every child thread with creation and exit times, exit code and start address (as module+offset). It never fired.I added B and D because the reproducing run above used below-normal priority. Priority alone does not trigger the hang here.
Deterministic controls (outside the repository)
Four CRT-free EXEs (
/ENTRY:start /NODEFAULTLIB,kernel32.libonly), each entry returning0x60dwith a plainretafterSleep(50). Same probe, 4 launches each, 2 s timeout, then up to 90 s of observation before termination.TrySubmitThreadpoolCallbackwith an empty callback, worker idle for ~50 ms0x60dTppWorkerThread, process handle unsignaled, killed after 96 sSetThreadpoolThreadMinimum(2), workers idleTppWorkerThreadthreads, killed after 96 sCreateThreadthread sleeping 3 s0x60d)The
TppWorkerThreadlabel comes from comparing each thread's start address with that of a default-pool worker created in the probe process (bothntdll+0x24990on this build).Mode 1 matches the end state in the original report: the entry thread is gone and a single thread-pool worker remains. I did not capture its stack. The process does not end once that worker becomes idle. In mode 0, a worker that was already idle when the entry returned did not prevent exit; I did not confirm that this worker was still alive at that moment.
What this suggests (hypothesis, not proven for the fixture)
retinnative_entry, whether the process ends depends on which other threads exist at that instant and on what they are doing.TppWorkerThreadin the debugger view, three threads created 55–63 ms after the initial thread in the timing capture) therefore come from ntdll or from outside the image. Candidates are the parallel loader's workers mappingcpu_exe_io.dll/cpu_import_provider.dlland their debug CRT dependencies, or threads injected by security software. Their creation 0–8 ms before the entry returns fits mode 1: workers still active when the initial thread exits.Possible next measurements on a reproducing machine
ntdll) from injected threads (another module). The probe records it.MaxLoaderThreadsvalue (REG_DWORD,1) underHKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\cpu_exe_original.exeturns off parallel DLL loading for processes with that image name only. It needs admin rights, is not officially documented, and the key should be deleted afterwards. If the timeouts disappear, the loader workers are the likely cause.I did not modify the shared entry,
pe_map_run, or any test. The probe (~200 lines, standard library plusctypes) can go in this issue or as a PR undertests/tools/, whichever you prefer.AI-assisted: prepared with the support of Roan System.
Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-21T23:33:47Z.
A reproducing environment, with the bounded comparison requested above. The hang first appeared here during a full-suite run (
cpu_aot_exe_entry, 15 s timeout) and reproduced again in a dedicated probe; the diagnostics below were captured at timeout, before terminating the child.Environment
c1b84b8(a topic branch rebased ontomainat9bdbb20);tests/cpu/exe_entry.asm,exe_io.cppandimport_provider.cppare unchanged fromb860dd5.cpu_exe_original.exeb33503106a4eaa2291228e72c3d6ab1e2be499fe846f2c918a968a71bccff09dcpu_exe_io.dllcca178b30c03e918ae0b001d4859b8755ee02d571fbf6fb270f8e67edce5a7d6cpu_import_provider.dll0a8fb3497d233a93b68569be0450d2f1ef16df7b56a54eb3a1a4b6c12d3bda75Method
Sequential launches, alternating selector 0/1 as one stdin byte, stdout/stderr drained by reader threads, 5 s timeout. At timeout:
WaitForSingleObject(process_handle, 0), then a 2 s grace period for the readers to observe EOF, then kill. 41 launches: 40 normal, 1 timeout.One normal launch (index 39, selector 1)
Exit code 87 (
0x57). stdout35 00 00 00 00 00 00 00; stderr30 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00(the recorded integers0x30,0x06). Both streams reached EOF.One timeout (index 40, selector 0, pid 11356)
11 03 00 00 00 00 00 00— the complete expected output row for selector 0. EOF: false.03 03 00 00 01 00 00 00 fd ff ff ff 00 00 00 00— the provider's two recorded integers0x100000303and0xfffffffd, the complete expected trace. EOF: false.What this measures, and what remains a hypothesis
All argument bytes and all eight output bytes of the selector-0 row were delivered before the timeout, so the entry's computation and the I/O DLL's writes completed. The process handle is not signaled and neither pipe reached EOF: a live thread in the process still holds the pipe write ends. That is consistent with the lingering-worker hypothesis (the entry finished its work while a worker keeps the process running), but this probe captured no thread creation/exit events, so which thread is alive — and whether the entry thread itself returned — is not measured. Per the decision tree above, this machine can support the native startup wrapper with a deliberately live worker as the next deterministic control.
Limits: no process/thread ETW events were captured; the earlier full-suite timeout on this machine was not instrumented. The probe is a ~70-line standard-library script; I can paste it here or open a PR under
tests/tools/, whichever is preferred.AI-assisted; runs executed locally on the configuration above.
Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-21T23:52:51Z.
Thread-level capture on the reproducing machine, following the "possible next measurements" list above (item 1). The hang reproduced at launch 100 and the child's full thread inventory was captured before termination. It matches the mode-1 end state exactly: the entry thread is gone and one idle
TppWorkerThreadkeeps the process alive.Environment
9bdbb20(main). Fixture sources unchanged; binaries rebuilt at this commit:cpu_exe_original.exe4304efc11da1eebd6aed0429ecaaaab535de20580f80520d5491f1bddd757bf1cpu_exe_io.dllfc4079723b728a6f00545b4c203b23bbb1432a9bbcdb366376d0957de10765e3cpu_import_provider.dll79e3d416b753f3d1bd2f9a9bf19a92b7afba0eaf5bb42e498e0638d96ff7568fMethod
The earlier probe extended with, at timeout and before killing the child:
CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD)filtered on the child pid; per threadOpenThread+GetExitCodeThread,GetThreadTimes, andNtQueryInformationThread(ThreadQuerySetWin32StartAddress); aTH32CS_SNAPMODULEsnapshot of the child to express start addresses as module+offset; the PE entry VA computed from the launched file'sAddressOfEntryPointplus its live module base. ATppWorkerThreadreference was created in the probe process viaTrySubmitThreadpoolCallbackand its start address recorded (same ntdll image across processes on one boot). Sequential launches, alternating selectors, 5 s timeout, 2 s EOF grace. 100 launches: 99 normal, 1 timeout. No child suspension or modification; no system or registry changes.The timeout (launch index 99, selector 1, pid 30120)
Process-level facts as before: handle unsignaled (also after the capture), stdout
35 00 00 00 00 00 00 00and stderr30 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00fully delivered (the complete selector-1 row), neither stream at EOF.The child had exactly one thread:
STILL_ACTIVE(259), exit time 0ntdll.dll+0x24990TppWorkerThreadreference (ntdll.dll+0x24990, ntdll base0x00007ff98df60000on this build).cpu_exe_original.exe+0x1000, live base0x00007ff759380000). The inventory is complete, so this is stronger than a start-address mismatch: the initial thread no longer exists — whatever start address it would have reported, only the worker remains.VCRUNTIME140D.dll,ucrtbased.dll,ntdll,kernel32,kernelbase. Nothing outside that set; the lingering thread's start address is inside ntdll, not an injected third-party module.What this establishes, and what remains open
Measured on the reproducing machine: the fixture's entry thread exits after delivering all of its output, and a single idle ntdll thread-pool worker keeps the process (and the pipe write ends) alive. That is the mode-1 end state from the deterministic controls above, now observed in the actual intermittent hang — including the mode-1/mode-0 asymmetry: an idle worker that outlives the entry prevents exit.
Still hypothesis: the worker's origin. The fixture creates no threads, so it comes from ntdll or the loader; the parallel-loader workers mapping the fixture DLLs and their debug CRT dependencies remain the candidate, and the
MaxLoaderThreadsIFEO experiment (item 2 above) is the discriminating test. I did not run it: it needs admin and a temporary registry change, and I left that decision to the maintainer. No call stacks, ETW events, or wait reasons were captured; the Toolhelp snapshot can race with thread exit, but the process was stable across the 5 s timeout plus the 2 s grace and the capture.STILL_ACTIVE(259) is ambiguous with a real exit code 259 in general; here exit time 0 and the unsignaled process handle corroborate a live thread.The extended probe is ~380 lines of standard library plus ctypes; I can paste it here or open a PR under
tests/tools/, whichever is preferred.AI-assisted; runs executed locally on the configuration above.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T23:57:45Z.
@abilliontokens, the capture at launch 100 answers the process-lifetime question: the initial thread had exited, another thread was alive, and the process handle was still unsignaled after the grace period. If you’d like to share the extended diagnostic, please link a pinned revision of a source-only gist or branch here with its invocation. That keeps the tool available to other reporters without introducing an administrator or IFEO requirement into CI.
The native termination wrapper can proceed on this evidence. Keep the #249 comparison on the same image and keep
pe_map_runreturning to its host. For the regression, use an event to confirm the worker is alive before the entry returns. On the native path, check that the process handle signals, both stdout and stderr reach EOF, and the exit code and output match. On the mapped path, verify normal return to the host. Identifying the worker’s creator can proceed independently. @RonLogic, once there’s a final candidate, a bounded rerun on the original reproducing machine would help confirm the fix.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T00:26:31Z.
@RonLogic, #394 now has a Windows-green candidate at
c32318a4c7a3cebcdd6409eca4af6e9d0c02e52b. Could you repeat your bounded native-child run on the original reproducing machine? Please record the Windows build, launch count, timeout count and output/exit status. If a launch stalls, the process signal state and EOF on each pipe would let us compare it with your earlier capture. #388 independently reproduces the returning-entry/live-worker control.Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-22T00:31:35Z.
The extended diagnostic, as requested — source-only gist, pinned revision:
https://gist.github.com/abilliontokens/15e0ef77afd0512acb21fc540417e62a/74a3882975692c728d0748fd4846a5c35fa69c55
Invocation, from the repository root on a quiet Windows x64 host with the dev preset built (Python 3.11+, standard library + ctypes only; no administrator rights, no registry or IFEO changes):
Arguments:
[max_launches=1500] [build_dir=out/build/dev]. It launchescpu_exe_original.exewith alternating selector bytes (5 s timeout each) until one launch times out, then captures — before killing the child — the process-handle signaled state, per-stream bytes and EOF after a 2 s grace, the full child thread inventory (exit codes, creation/exit/kernel/user times, Win32 start addresses as module+offset via a child module snapshot), the entry-VA match from the launched file's PE header, and aTppWorkerThreadreference created in the probe process viaTrySubmitThreadpoolCallback. One JSON report on stdout; progress every 100 launches on stderr. The header comment lists what remains unmeasured (no call stacks, ETW, wait reasons, or thread names). The capture posted above came from this script at the pinned revision.Taking the native termination wrapper next, per your spec: event-confirmed live worker before entry return, native path checks (handle signals, both pipes EOF, exit code and output match), mapped
pe_map_runreturning to its host, and the #249 comparison on the same image. Will link the PR here. @RonLogic the bounded rerun offer on a reproducing machine stands — this box reproduces (~1 in 40–100 launches) and can run it once there is a final candidate.Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-22T00:36:48Z.
Correction to my previous comment: #394 already implements the wrapper per the spec above (event-confirmed live worker,
finish_exeprocess-mode detection,pe_map_runreturning to its host, same-image chain), Windows-green atc32318a4. Rather than open a duplicate implementation, this reproducing box will run the independent bounded verification @R0Y00 asked for: the unwrapped baseline probe, the newcpu_native_exe_terminationregression, the chain/startup group, and bounded launch series against the wrappedcpu_exe_original.exe(normal andCPU_EXE_TEST_LIVE_WORKER=1), recording Windows build, launch counts, timeout counts, exit/output status, and — if anything stalls — the process signal state and per-pipe EOF from the pinned probe. Results will be posted here and on #394.Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-22T00:38:56Z.
I repeated the requested native-child check on the original reproducing machine. I built #394 at
c32318a4c7a3cebcdd6409eca4af6e9d0c02e52bfrom source in a clean checkout on Windows 11 x64 build26300.9974, using the Debug preset and Visual Studio 2026 18.12.1.300/300 launches completed with zero timeouts. I launched
cpu_exe_original.exedirectly, outside CTest andpe_map, with one byte on stdin, separate stdout and stderr pipes, and a 5 s timeout per launch. Selectors00and01alternated, with 150 launches each. Every launch matched its expected output and exit code.0011030000000000000303000001000000fdffffff000000000x60d013500000000000000300000000000000006000000000000000x57The process handle signaled and both pipes reached EOF on every launch. There was no stalled child to sample before cleanup. For comparison, the earlier unwrapped run on this machine stalled on launch 63 with the process still alive and both pipes open.
cpu_exe_original.exe7f034cc0c16373d2f45e5c2fb08b97c01cbd8f7fb69062b374825ee24767c883cpu_exe_io.dll544b133cdaef493dc330ded9816fbc4671c55c2c3114f6f0f3773a3e11e9d95bcpu_import_provider.dll9acbbf6294f4c1502df0c79ad89ad74d90b818309e4724cb58038c7c2f536ae1Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-22T00:41:47Z.
Bounded verification of #394 at
c32318a4c7a3cebcdd6409eca4af6e9d0c02e52bon this reproducing machine, as requested above. The wrapper eliminates the hang signature here — both statistically and with a deliberately live worker.Environment
c32318a4, built with thedevpreset in an isolated worktree. Wrapped binaries:cpu_exe_original.exe8964c971b0239ba78fb55947763c3a2b2febd2ea1184abab5c59107db6ffa6a3cpu_exe_io.dll2596edcbbc96711d03ddda28a43b5e65b7f9daf752ae2b259778b50b440fb6a6cpu_import_provider.dlldc9318dc5f87d687ab43229ee1a724cb827caf9be17a171806f02c4450b2547bLaunch series (pinned probe, quiet host)
Probe: https://gist.github.com/abilliontokens/15e0ef77afd0512acb21fc540417e62a/74a3882975692c728d0748fd4846a5c35fa69c55 —
python probe281_threads.py <launches> <build-dir>, alternating selector bytes, 5 s timeout, diagnostics before kill.main(9bdbb20, exe4304efc1…)c32318a40x60d, 750 ×0x57; the probe aborts on any unexpected exit), both pipes EOFc32318a4,CPU_EXE_TEST_LIVE_WORKER=1The baseline control reproduced on the same machine, same session, before the wrapped series ran.
Test results at
c32318a4cpu_native_exe_termination(5.5 s) — event-confirmed live worker before entry return, native process handle signals + both EOFs + exact bytes/exit for both selectors and empty stdin, the unwrapped negative control stalls as expected, and the mapped path returns to its host (mapped host returned).bvh_wave64_hardware(NVIDIA lanes 32..32),bvh_wave64_warp(WARP 4..4),wave_shuffle_warp(width-4 self-inverse). The #249 same-image chain (cpu_native_exe_chain) and the AOT comparison pass on the wrapped image.Limits
This confirms the candidate on this reproducing environment (Windows 26200.9711, this driver/loader state); it is not a run on the original reporter's machine. No launch stalled in the wrapped series, so there are no new stall diagnostics to compare. Worker-creator identification remains the separate track noted above.
AI-assisted; runs executed locally on the configuration above.
Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-22T01:18:15Z.
I ran the #394 startup checks on Windows 10 22H2 build
19045.6456, using source-built x64 Debug fixtures and VS 2022 Build Tools (MSVC19.44.35230.0, SDK10.0.26100.0). I compared mergee5e00797with its first parenteab82c20.cpu_native_exe_termination.0x60d,0x57, and0x2for selectors 0 and 1 and empty input. The mapped host returned. The temporary unwrapped control returned0x60dfrom entry, with the process and both pipes still open after five seconds.Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-22T01:20:34Z.
Taking the independent creator-identification track you noted, via the discrimination test @roansystemlabs proposed (item 2): a temporary
MaxLoaderThreads=1(REG_DWORD) underHKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\cpu_exe_original.exe, scoped to that image name only, on this reproducing box (Windows 26200.9711). Procedure: baseline probe series without the key (reconfirm reproduction today), the same series with the key set, then key removal (verified absent afterwards) and a post-removal control series to guard against machine-state drift. The key is verified absent before creation and removed in a finally block; no other registry or system state is touched. If the timeouts disappear with parallel loading disabled and return after removal, the loader workers are the likely creators of the lingeringTppWorkerThread. Will post the launch/timeout counts and any thread captures here.Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-22T01:21:59Z.
Creator identification, via the discrimination test proposed above (item 2): disabling parallel DLL loading eliminates the hang on this machine, and removing the setting brings it back. The lingering worker comes from the parallel loader, not from an injected thread.
Method
Temporary
MaxLoaderThreads=1(REG_DWORD) underHKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\cpu_exe_original.exe— scoped to that image name only. The key was verified absent before creation and removed in afinallyblock (removal verified byTest-Path); no other registry or system state was touched. Probe: the pinned gist revision linked above,python probe281_threads.py <cap> out/build/dev, alternating selectors, 5 s timeout, thread capture before kill. A/B/A order in one session on a quiet host.Environment
9bdbb20(fixture sources unchanged sincec832696; unwrapped image — #394 not applied here).cpu_exe_original.exeSHA-2564304efc11da1eebd6aed0429ecaaaab535de20580f80520d5491f1bddd757bf1;cpu_exe_io.dllfc4079723b728a6f00545b4c203b23bbb1432a9bbcdb366376d0957de10765e3;cpu_import_provider.dll79e3d416b753f3d1bd2f9a9bf19a92b7afba0eaf5bb42e498e0638d96ff7568f.Results
ntdll.dll+0x24990(TppWorkerThreadreference match), zero CPU time; entry thread goneMaxLoaderThreads=1ntdll+0x24990worker, entry thread gone, handle unsignaled, no EOFWhat this establishes, and limits
On this machine the hang requires parallel DLL loading: with loader threads serialized the fixture exited cleanly 1500/1500, and the hang returned within 124 launches once the setting was removed. Combined with the thread captures (one idle ntdll thread-pool worker, no foreign modules loaded), this attributes the lingering
TppWorkerThreadto the parallel loader's work — consistent with the hypothesis above that loader workers mapping the fixture DLLs and their debug CRT dependencies (VCRUNTIME140D.dll,ucrtbased.dll) are still active when the entry returns. The dependency count and loader timing would then explain the machine dependence and intermittency.Limits:
MaxLoaderThreadsis undocumented, and this is one machine/build; the test shows parallel loading is necessary for the hang here, not which specific loader callback spawns the worker (no call stacks were captured). It does not change the wrapper design in #394 — the termination fix stands on its own evidence — and it does not replace a run on the original reporter's machine. The IFEO key no longer exists on this host.AI-assisted; runs executed locally on the configuration above.
Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-22T01:24:19Z.
Post-merge confirmation on this reproducing machine: #394 is now in
mainate5e0079. Rebuilt the dev preset at that commit and ran:cpu_native_exe_termination(event-confirmed live worker, native handle/EOF/exit checks, unwrapped negative control, mapped host return) and the same-image chain.cpu_exe_original.exe(SHA-256e36f107a1e482d06128705c7dcea458b373f7a0dddd233c42317505560b5c6c1): 300 launches, 0 timeouts, every launch the expected exit code with both pipes at EOF. Windows 11 Pro 26200.9711, MSVC 14.44.35207 Debug.Together with the pre-merge A/B/A attribution above (baseline hang → 0/1500 with
MaxLoaderThreads=1→ hang returns after removal), the mechanism and the fix are both confirmed on this environment. The original reporter's machine remains the outstanding confirmation. No IFEO or other system state persists from these runs.Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-22T02:01:33Z.
Cross-posting a verification of the deterministic control proposed for this issue in #388 (details and raw output on the PR: https://github.com/R0Y00/Xbox2Windows/pull/388).
On this machine — the one that reproduces the intermittent hang (26200.9711, MSVC 14.44.35207, PR head
74dfca2built clean, 377/377) — the control is fully deterministic, 20 launches per fixture beyond the ctest's 2:cpu_exe_worker_alive_original(worker +ExitThread): timeout 20/20 — handle not signaled, exactly 1 live thread, stdout 22 bytes delivered, no EOF on either pipe.cpu_exe_worker_alive_returning(worker + entry returns): timeout 20/20 — identical signature.cpu_exe_worker_alive_no_worker(no worker, entry returns): exit 20/20, code0, both pipes at EOF.returningreproduces deterministically the end state this machine hits ~1 in 40–100 launches on the real fixture: entry thread gone, one idle worker left behind, handle never signals, stdout delivered but neither pipe EOFs. Same signature we captured here on the real hang (one idlentdll!TppWorkerThread, zero CPU time) — the control swaps the loader's worker for an explicit one, so it validates the end state and the probe harness rather than the loader attribution itself (that stands on theMaxLoaderThreadsA/B/A above, and the fix in #394). Suite on the PR tree: 147 tests, 144 passed / 0 failed / 3 capability-skipped (bvh_wave64_hardware,bvh_wave64_warp,wave_shuffle_warp); newcpu_native_worker_alivepasses; neighborhoodcpu_native_exe_chain,cpu_native_exe_startpass. No first mismatch — no mismatch at all in 60 control launches.One merge-order note: #388 branched before #394 landed, so its tree does not yet contain
cpu_native_exe_termination; GitHub still reports the merge clean, and the two tests coexist after merge. Limits: one machine, debug layer unavailable.AI-assisted; runs executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-22T03:10:19Z.
Another reproducing machine, before and after #394, for the record.
Environment: Windows 11 Pro 26200.9974, VS Build Tools 2026 18.10.3 (MSVC 19.51.36260.0), SDK 10.0.26100.8249,
Python 3.13.15, dev preset (Debug), RTX 3080. Every count below is from separate
ctest --preset dev --no-tests=error -R '^<test>$'runs.e726864(before #394)c2fc84c(main, includes #394)cpu_aot_exe_entrycpu_native_exe_chaincpu_native_exe_startcpu_native_exe_terminationSo #394 removes the hang signature on this machine too.
cpu_native_exe_startstill fails after #394. Onc2fc84cit failed 2 out of 20 times. Its message,AssertionError: native launch does not run the TLS callback (null reserved) before the entry point, is misleading:the TLS callback runs fine, and the native launch just has the same lingering-process signature as this issue. I
captured the reported exit codes over 80 ctest runs. The
exe_start.asmfixtures and their CMake setup are the samein that tree and in
main. 6 of the 80 runs failed, each after about 30 s:Each time, one of the two EXEs exits with 0 instead of its entry's return value after about 30 s. The TLS
digits are never wrong. That matches the parallel-loader worker idle-out described above, where the process ends
with the last thread's exit code. #394 wrapped only
cpu_exe_original/cpu_exe_inverted(exe_startup.asm→
finish_exe).cpu_exe_start_originalandcpu_exe_start_no_tlsare still linked with/ENTRY:exe_entryandreturn from the entry point (
CMakeLists.txt, thecpu_exe_start_${variant}loop), so they keep the hang.Possible follow-up: give the
exe_startfixtures the same terminating startup as #394. The import-request assertionin
native_exe_start_check.pywould then have to accept the extrafinish_exebinding. Alternatively, have thecheck report "process lingered / exited 0" instead of the TLS message. I haven't implemented either.
This comment is AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T03:27:25Z.
@JB2WIN, please proceed with the startup-wrapper follow-up for
cpu_exe_start_originalandcpu_exe_start_no_tls. Reuse #394’s native termination wrapper and keep the return-based body callable throughpe_map_runin the very same image. Preserve TLS callback order, the no-TLS control and the existing failure branches. Innative_exe_start_check.py, update the expected imports to include the wrapper’sfinish_exebinding while continuing to check the other requests.For the deterministic control, have a worker signal readiness and remain alive while the body returns. Observe the body’s return, the native process handle becoming signaled, and the TLS values separately, so a lingering process gets its own diagnostic. On the mapped path, verify that the host regains control with the expected result. If the same binary cannot preserve those observations on both paths, please post the first divergence with the variant, expected result and actual result before changing the fixture contract.
Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-22T04:51:53Z.
I found the same process-exit symptom on the source-built CRC fixture introduced by #455. Tested merge
3a806d3on Windows 10 22H2 build 19045.6456 with MSVC 19.44.35230 and Windows SDK 10.0.26100.0.In both Debug and Release, ctest --preset <dev|release> --no-tests=error -V -R "^cpu_native_crc_line$" failed in the native EXE arm. Release printed CBF43926 with CRLF for 123456789, and the entry thread returned 0. After 15 seconds the process still reported 259 (STILL_ACTIVE), neither pipe had reached EOF, and one other thread remained. Debug showed the same state on the CRLF/trailing-input case.
I then ran the cases independently. Both pe_map on the original return-based image and the recompiled EXE passed all 24 piped-input launches and all four read-only-stdout cases. The native image stayed alive after its entry returned in six of 24 piped-input launches, and two native read-only-stdout cases timed out separately. A scratch native-only wrapper linked against the same CRC objects and called ExitProcess with the body’s return value. It passed all 28 checks.
The remaining thread’s identity is unresolved. The result suggests applying the native termination pattern from #394 to this new fixture while preserving the return-based body for mapping and AOT.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T05:11:10Z.
Thanks for isolating the CRC case from #455. The 28 scratch-wrapper checks give us a candidate to review. Please link the source change here when ready. For the three-way check, record the SHA-256 of the original EXE used for native launch, pe_map and input to AOT. Keep the returning CRC body callable by the mapped host. With a worker held alive by an event, check the native process handle, EOF on both pipes, output bytes and exit code separately, then verify that the mapped host regains control. Please retain the piped-input and read-only-stdout cases in Debug and Release.
Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-22T06:59:23Z.
The CRC startup change is up in #487. The PR records the four source EXE SHA-256 values and the separate native process, pipe EOF, output, exit status and mapped-host return checks. The piped-input and read-only stdout cases passed locally in Debug and Release.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-22T14:28:42Z.
@R0Y00 the startup-wrapper follow-up you asked for is up as #589. It reuses #394's
exe_startup.asmunchanged, keeps the body callable throughpe_map_run, and expects the extrafinish_exebinding. A live-worker control observes the body's return (body_status), the process handle and the TLS digits separately. In the mapped path the host regains control with0x60d/0x20d. On this machine^cpu_passes 112/112,cpu_native_exe_startpasses 40/40, and the unwrapped control is red as expected. Divergence between the native and mapped paths: none found.This comment is AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T15:17:45Z.
The remaining
cpu_exe_start_originalandcpu_exe_start_no_tlsfixtures now use the same native termination wrapper as #394. #589 merged at3ffc193. The final Windows control checks the process handle, clean EOF on both pipes and the exit code, and confirms thatpe_map_runreturns the body result to the host.@RonLogic, if you can retest on the original machine, please run
ctest --preset dev --no-tests=error -R '^cpu_(native_exe_chain|native_exe_start)$' --repeat until-fail:10 -Von current main. Please report the tested commit, Windows build and outcome. If it recurs, the first case and whether the handle and each pipe reached their terminal states are enough.Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-22T16:34:09Z.
I retested on the original machine with Windows 11 build 26300.9974, x64 MSVC 19.52.37029.0 and Windows SDK 10.0.26100.0. The clean
maincheckout was2f1f832215fcd3828d2d1aed1470b723af738c9b, which includes #589.cpu_native_exe_chainpassed all 10 runs.cpu_native_exe_startpassed all 10 runs. With the worker held alive, the native process handle signaled and both stdout and stderr reached clean EOF. The TLS variant exited with0x60dand digits[1, 2]. The no-TLS variant exited with0x20dand digits[2]. The mapped host regained control with the matching body status in both cases.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T19:21:22Z.
Closing this after the original-machine retest on main. With the shared termination wrapper from #589,
cpu_native_exe_chainandcpu_native_exe_starteach passed 10 runs at2f1f832. The live-worker case signaled the process handle and closed both pipes, and the deliberate open-stdout and open-stderr controls were reported separately. If it recurs, the first failing case, commit, process-handle state and per-pipe EOF are enough to reopen.