fix(shader): remove expired disk-cache trees without the remove_all hang #16088

Merged
nabil88 merged 2 commits from upstream-pr/16088 into main 2026-11-12 07:32:25 +00:00
nabil88 commented 2026-11-05 16:26:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nabil88 on 2026-11-05T16:26:29Z.


What

ShaderDiskCache::housekeeping() deleted expired cache directories with std::filesystem::remove_all. On Windows, MinGW libstdc++ up to GCC 16 does not treat a reparse point as a link, so remove_all recurses through it and never terminates; the libstdc++ fix is only in GCC 17 (commit 88856ad855ae). The eviction now calls RemoveTree, the helper added in #7039: it removes a reparse point as the link it is, clears the read-only attribute and retries, and reports the first native error. Other hosts still call remove_all. The header is added to shaderCacheKeySources so the disk-cache key covers it, as it already does for the other libc headers the cache includes.

Tested

Windows, WinLibs GCC 15.2.0 (the supported toolchain), full build-full tree.

  • ctest --test-dir build-full -R agc_shader_disk_cache: 5/5 passed. agc_shader_disk_cache 9.5 s, agc_shader_disk_cache_pack_ownership, agc_shader_disk_cache_large_file, agc_shader_disk_cache_long_paths and agc_shader_disk_cache_host_stderr.
  • ctest --test-dir build-full -R "shader_cache_runtime_sources|agc_shader_disk_cache": 12/12 passed, including the shard split. The key-source fixture now stubs RemoveTree.hpp next to the other libc headers the cache key hashes.
  • The change is filesystem-only: it only affects the deletion of expired cache directories and does not touch shader translation or rendering.
  • This host has no Vulkan validation layer installed (no VULKAN_SDK, no VkLayer_khronos_validation.dll), so the VK_LAYER_KHRONOS_validation comparison could not be run.

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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (filesystem-only change; no GPU path is touched and the disk-cache tests create no device)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5174962686 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16088). Originally posted by [nabil88](https://github.com/nabil88) on 2026-11-05T16:26:29Z. --- ### What `ShaderDiskCache::housekeeping()` deleted expired cache directories with `std::filesystem::remove_all`. On Windows, MinGW libstdc++ up to GCC 16 does not treat a reparse point as a link, so `remove_all` recurses through it and never terminates; the libstdc++ fix is only in GCC 17 (commit 88856ad855ae). The eviction now calls `RemoveTree`, the helper added in #7039: it removes a reparse point as the link it is, clears the read-only attribute and retries, and reports the first native error. Other hosts still call `remove_all`. The header is added to `shaderCacheKeySources` so the disk-cache key covers it, as it already does for the other libc headers the cache includes. ### Tested Windows, WinLibs GCC 15.2.0 (the supported toolchain), full `build-full` tree. - `ctest --test-dir build-full -R agc_shader_disk_cache`: 5/5 passed. `agc_shader_disk_cache` 9.5 s, `agc_shader_disk_cache_pack_ownership`, `agc_shader_disk_cache_large_file`, `agc_shader_disk_cache_long_paths` and `agc_shader_disk_cache_host_stderr`. - `ctest --test-dir build-full -R "shader_cache_runtime_sources|agc_shader_disk_cache"`: 12/12 passed, including the shard split. The key-source fixture now stubs `RemoveTree.hpp` next to the other libc headers the cache key hashes. - The change is filesystem-only: it only affects the deletion of expired cache directories and does not touch shader translation or rendering. - This host has no Vulkan validation layer installed (no `VULKAN_SDK`, no `VkLayer_khronos_validation.dll`), so the `VK_LAYER_KHRONOS_validation` comparison could not be run. ### Checklist - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (filesystem-only change; no GPU path is touched and the disk-cache tests create no device) - [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!16088
No description provided.