Skip to content

fix(persistence): Close restored RAF handles on resume failure#1072

Merged
leumor merged 6 commits intorelease/2from
bugfix/windows-restore-failure-handle-cleanup
Feb 22, 2026
Merged

fix(persistence): Close restored RAF handles on resume failure#1072
leumor merged 6 commits intorelease/2from
bugfix/windows-restore-failure-handle-cleanup

Conversation

@leumor
Copy link
Collaborator

@leumor leumor commented Feb 21, 2026

Summary

  • Close restored RAF handles in restore/resume failure paths so Windows can delete @TempDir trees reliably.
  • Keep runtime/crypto semantics unchanged: only close handles on failure, never delete persistent data.
  • Add Windows-gated regression tests for the two core patterns:
    • PaddedRandomAccessBuffer restore fails after underlying RAF restore.
    • EncryptedRandomAccessBuffer restore fails with wrong secret after underlying RAF restore.

Code Paths Updated

  • PaddedRandomAccessBuffer restoring constructor: close restored RAF in finally when size validation fails.
  • EncryptedRandomAccessBuffer.create(...): close restored underlying RAF when crypto initialization throws.
  • SplitFileFetcher trivial-progress restoring constructor: close partially restored RAF if constructor fails before completion.
  • SplitFileInserterStorage.chooseOriginalData(...): close restored descriptor when external originalData is used (both mismatch and equality path).

How To Test

  • ./gradlew test --tests *PaddedRandomAccessBufferTest --tests *EncryptedRandomAccessBufferTest
  • ./gradlew test

Notes

  • PR base branch is intentionally release/2 per request (current branch at PR creation time).

…ompatibility

Improve test stability by adding proper resource cleanup and robust handling for Windows-specific filesystem behavior such as hidden files and stale file handles.
Fix KeyGenUtils Java version parsing for values without separators (for example 21) so runtime detection no longer falls back to Java 7 behavior.

Add regression tests that validate major-only and dotted version parsing through KeyGenUtils.getJavaVersion().
Remove reflective use of sun.misc.Unsafe.invokeCleaner from BloomFilter.

Use FileChannel.map(..., Arena) with MemorySegment force/close lifecycle and route file-backed Binary/Counting Bloom filters through the shared mapper helper.

This keeps deterministic mapped-buffer cleanup while eliminating terminal deprecation warnings on JDK 25 test runs.
Use \\040 in CSSParserTest text block expectation to preserve spacing semantics while avoiding Error Prone MisleadingEscapedSpace.
Avoid indefinite waits in createJreImage when jlink does not terminate cleanly on Windows.

- Stream and log jlink output via a dedicated pump thread

- Add a 10-minute timeout and force cleanup of lingering jlink processes

- Treat timeout as success when build/jre is complete

- Keep compression enabled by default and allow override via -PjlinkCompression
@leumor
Copy link
Collaborator Author

leumor commented Feb 22, 2026

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 🎉

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
72.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@leumor leumor merged commit b6da8fa into release/2 Feb 22, 2026
3 of 4 checks passed
@leumor leumor deleted the bugfix/windows-restore-failure-handle-cleanup branch February 22, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant