Repository navigation
fix(savedata): recover from metadata setup failure - #1680
Conversation
Report SAVE_DATA_ERROR_INTERNAL when setupSaveDataMemory2 fails to persist initial SaveDataParam metadata, and restore previous state so retrying setup can initialize cleanly. Closes boykopovar#1667.
|
Reviewed
I compiled and ran |
…ck recovery Write initial SaveDataParam metadata before replacing the memory blob so metadata failure cannot leave a prematurely grown blob. Handle blob write failure with metadata rollback, and allow retries to recover slots with missing metadata. Expand tests with nonzero data, blob failure, and fresh readback.
|
Thanks @Sanjaysrinivas for the detailed review and the concrete failure reproductions. Pushed �8c2100f addressing both P1 and P2:
All 6 savedata suites pass 100% locally under ctest. |
|
Please drop the |
|
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
No title was run. 🤖 Addressed by Claude Code |
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the rework. Dean's request from 2026-10-09 is still pending on the current head (a8c2100):
core/libs/prx/libSceSaveData.native/Export.cpp:653-660: drop the.paramrollback (theremove/rewrite ofparamPathafter the blob write fails).Export.cpp:647-649(and the blob write failure at 652-662): a failedwrite_file_replaceis a host write failure with no console code, so throwstd::runtime_errorinstead of returning0x809F000B. Keep writing the param first and re-running setup when it is missing, that part is fine.core/libs/tests/SaveDataMemoryMetadata.cpp:134-190: these cases pin the rollback and the error code; rewrite them for the new behaviour (exception on param write failure, retry with the same size re-initialises because the param is missing).
Please also drop the now unused originalParam read (Export.cpp:636-639) once the rollback is gone.
|
Posting the relevant part of my reproduction of #1667 here, because this PR is the one carrying the review that asks for it. adriadam10's review asks that a failed The parameter-first ordering itself works: the retry really does persist a 128-byte zero-filled blob and the requested metadata, which is the behaviour #1667 asks for. The crash comes only from the exception leaving the library. Controls I ran on the same build:
The likely cause is an allocator mismatch across the boundary. Two things I would add for whatever lands here:
I could not reproduce this on Windows; I only had Linux. #2677 says it was tested on Windows, and I opened #2840 for this, based on current |
|
Pushed commit 6a7cce4 addressing the review feedback and test matrix requirements:
|
|
Please throw |
|
@oneandonlydean we implemented your request on top of current main (throw
Could you confirm how it crosses cleanly on your setup (branch/commit), or should this keep returning |
|
@adriadam10 you're right, I took the @emirplus that leaves the template's What, Tested and Checklist sections in the PR body (Conventions fails without them). |
|
Ready to merge from my side, but the PR description fails the conventions check:
Please fill those template lines in (only you can answer AI-assisted); it merges once they pass. |
|
@adriadam10 The PR description checklist has been updated with - [x] AI-assisted: yes. Ready for merge. |
The throw this review asks for was withdrawn on 10-11; the PR was marked ready by the reviewer on 10-11 09:23Z and its full build is green on the current head.
What
Fixes #1667.
sceSaveDataSetupSaveDataMemory2ignored the result ofwrite_file_replacefor the initialSaveDataParam. After a failed param write it returned success, and a retry with the same size skipped initialization because the blob already existed.Now the param is written before the blob, setup re-runs when the param is missing (
needParam && !haveParam), and a failed param or blob write returnsSAVE_DATA_ERROR_INTERNAL(0x809F000B) without touching the result struct, assetSaveDataMemory2does for the same failure. A host exception is not used: it does not cross the PRX frame on Linux (see the thread).Tested
savedata_memory_metadata,savedata_memory_growth,savedata_memory_growth_read_failure,savedata_core_write_replacement,savedata_native_write_replacement,savedata_replace_file_failurepass.SaveDataMemoryMetadata.cpp: fresh slot with param failure and retry, growth with param failure and retry, blob failure after param, noinit_param/option 0, per-slot and per-user isolation, orphan blob without param.a8c2100f:savedata_memory_metadatapasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)