Windows: after a guest dup2 onto descriptor 2, host stderr logging fills the guest's 4 KiB pipe; Eternal Darkness (PPSA99314) stalls at start-up #7791
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 boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-19T07:46:51Z.
Eternal Darkness (PPSA99314, homebrew catalog) sometimes stops drawing at start-up on Windows: the window title stays at
FPS: 0.00 (17)for the whole run. Onmain64a9caa62(Windows 11, RTX 3080, WinLibs GCC 15.2, Release) that happened in 5 of 28 runs of 30 s (an earlier build,4ffb0cd12, stalled in 1 of 5 runs of 60 s); the other runs reach about 14 fps. In every stall the log ends after twoRunThreadlines, where normal runs print the firstStorageTextureline next.The title moves its standard error into a pipe and forwards what it reads to the kernel log: it logs
starts (standard error to klog: yes), and it importspipe,dup2,fdopenandread. Guest descriptors are host CRT descriptors, so itsdup2replaces the host's descriptor 2 as well. In one stall descriptor 1 was also a pipe although stdout had been redirected to a disk file at launch, so the title appears to replace standard output the same way.2585eeb7ealready keeps a copy of the host's standard error sosceKernelDebugOutTextdoes not write into the guest's pipe (there, to stop a title from reading its own debug output back and logging it again). Since438d41082, on LinuxPreserveHostStandardErrorgoes throughKeepHostStandardError_nid_no_patch, which also points the process'sstderrat that copy. On Windows it only takes_dup(2):c22654102restores the Win32 standard handle withSetStdHandle, but the CRT'sstderrstream still writes through descriptor 2. So the host's ownfprintf(stderr, ...)calls keep writing into the guest's pipe, andpipe_nid_postfixcreates that pipe with a 4096-byte buffer (_pipe(native, 4096, _O_BINARY)).What two stalled processes showed. In the first I used gdb, including inferior calls for
_get_osfhandleandGetFileType, which killed the process afterwards. In the second I only read registers and stacks, and used a separate probe process that duplicates the process's handles and queries each pipe with a timeout.AgcDriver::Graphics::StorageTexture::Refresh()is blocked inZwWriteFileunderfwriteand__mingw_fprintf. Every direct print inRefresh()is anfprintf(stderr, ...)(the[upload],[dcc-keys]and[gpu]lines). In the first stall its handle was_get_osfhandle(2), a pipe (GetFileType= 3).dup2_nid_postfixrestores them withSetStdHandle; the redirection lives in the CRT descriptor table.sceKernelReadblocked on them, so the blocked write is almost certainly on the full pipe.RtlEnterCriticalSectionunderfwrite, consistent with the stderr stream lock the writer holds: a guestvfprintf(vfprintf_nid_postfix),AgcDriver::AsyncLog::Housekeeping()(the async logger thread, so the stdout lines such asStorageTexture ...stop too) andShaderDiskCache::DiskStore::report.So host log lines fill the guest's pipe and nothing drains it. Guest frames have no symbols, so I could not show which thread the title uses to drain it. If it is the guest
vfprintfthread waiting for the lock, the wait never ends; if not, the drainer is stuck elsewhere. Either way the host's own logging is what fills the pipe. In a separate, earlier stall capture the main thread and one other thread were spinning at 100% CPU inTimedWaitcode, presumably waiting for work behind this.From the code, Linux should not be affected the same way: there the process's
stderrpoints at the kept copy once the guest replaces descriptor 2, and the pipe holds 64 KiB. I could not test this; Linux headless runs stop earlier for an unrelated Vulkan reason.Possible directions:
stderr. Keeping only descriptor 2 would still leave host stdout lines in a guest pipe when the title replaces descriptor 1 too._pipea larger buffer (FreeBSD pipes grow to 64 KiB). That makes the stall rarer but leaves the host's log lines in the title's kernel log.AI-assisted: yes