Contain pipeline cache save allocation failures #1046
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1046
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/pipeline-cache-save-errors"
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?
Pipeline cache saves can throw while allocating their byte buffer or temporary filename. A detached worker then terminates the process; a forced save propagates the exception and can leave the busy flag set.
Contain standard exceptions in the save worker, release the busy flag on every worker exit, and report thread-construction failures. Successful saves, thresholds and the existing forced-save behavior are preserved.
Validation on the refreshed main source:
c4ea255; that release tree was not edited or built by this refresh.Refs #1022. These checks use real C++ containers/threads with authored Vulkan/file responses, without a GPU, game or real pipeline cache. The refresh does not add a new renderer/game run or prove an operating-system thread/detach failure. Concurrent forced callers and the cache format retain their existing behavior. Hosted Windows renderer, Builder packaging, Linux AppImage, native F2I, SPIR-V and workflow-lint checks pass. Both source jobs fail solely on the existing answer-domain fixture tracked in #1076; the new cache-save test passes in both. See platform builds, AppImage and source checks.
Looks good. The Done guard releases busy on every worker exit, bad_alloc/length_error from the vector and the tmp path are caught in both the detached and forced paths, and a failed save never touches the existing cache (tmp file then rename). The thread-construction catch resets busy correctly. The new test is registered in run_all.py with a {cxx} ARGS entry, and it exercises the real function text with real containers/threads. The change doesn't touch pcache_init, so it doesn't conflict with the _fseeki64 change. I couldn't pull the job logs, so I'm relying on your note that the new test passes and the two red source jobs are the #1076 fixture.
Two small things, both pre-existing and fine as follow-ups (one inline comment below):
@ -6728,0 +6736,4 @@busy = false;logf("vk: could not start pipeline cache save: %s", e.what());}}Nit, not new in this PR: with a full disk fwrite can succeed into the stdio buffer and the error only shows up in fclose, so ok stays true and the truncated tmp gets renamed over a good cache. Something like
const bool ok = fwrite(...) == n; const bool closed = fclose(f) == 0; if (ok && closed) ...(and remove the tmp otherwise) would close that. The same call-2 path also drops the save on VK_INCOMPLETE if the cache grew after the size query; a retry or a small headroom on the buffer would cover it.