Repository navigation
Conversation
The runtime textures and the restore of a missing `rtx.conf` each had
their own way of writing a file. `extractTextures` copied to a staging
file and moved it with no retry, and left the staging file behind when
either step failed. `restoreMissingRtxConf` copied straight onto the
live path, so an interrupted copy left a truncated `rtx.conf`. Because
the file then existed, no later launch restored it until the next
version change.
Both now call `writeThroughStaging`, the helper the author-owned
payload uses: copy to `<name>.staging`, flush, move into place with the
usual retries, and remove the staging file if anything fails.
The `rtx.conf` swap at the end of a full extraction now uses
`moveReplacing`. Its comment said the move was `ReplaceFileW`
underneath. A `REPLACE_EXISTING` move without `ATOMIC_MOVE` deletes the
target and then renames, which left a moment with no live conf.
The flush is cheap here. The JAR ships one texture of about 0.7 MB, and
writing a file of that size took 3.2 ms with the flush against 0.6 ms
without on a SATA SSD.
## Testing
- `DirectoryRuntimePayloadTest` gains three tests, each of which failed
before the change:
- a texture copy that fails partway left its staging file behind;
- a texture move blocked by an open handle failed at once instead of
succeeding when the handle closed;
- an `rtx.conf` restore that fails partway left a truncated conf.
- `gradlew build test` passes for each 1.21.1 loader with 0 failures:
Fabric 925 JVM tests, Forge 905, NeoForge 899.
- The `rtx.conf` swap has no test of its own. The difference shows only
if the process dies between the delete and the rename.
- Not run in a game.
Signed-off-by: Sam Bourne <sbourne@nvidia.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The runtime textures and the restore of a missing
rtx.confdid not get the staged write that #103 gave the author-owned payload. Both now use the same helper.Changes
extractTexturescopied to a staging file and moved it with no retry, and left the staging file behind when either step failed. It now callswriteThroughStaging: copy to<name>.staging, flush, move into place with the usual retries, and remove the staging file if anything fails.rtx.confrestore.restoreMissingRtxConfcopied straight onto the live path, so an interrupted copy left a truncatedrtx.conf. Because the file then existed, no later launch restored it until the next version change. It now callswriteThroughStagingtoo.rtx.confswap. The swap at the end of a full extraction now usesmoveReplacing. Its comment said the move wasReplaceFileWunderneath. AREPLACE_EXISTINGmove withoutATOMIC_MOVEdeletes the target and then renames, which left a moment with no live conf.Testing
DirectoryRuntimePayloadTestgains three tests, each of which failed before the change:rtx.confrestore that fails partway left a truncated conf.gradlew build testpasses for each 1.21.1 loader with 0 failures: Fabric 925 JVM tests, Forge 905, NeoForge 899.rtx.confswap has no test of its own. The difference shows only if the process dies between the delete and the rename.🤖 Generated with Claude Code