Skip to content

fix(demo): dispose sqlite persister before folder rename in wallet service#112

Open
Ugarba202 wants to merge 1 commit into
bitcoindevkit:mainfrom
Ugarba202:fix/windows-wallet-service-file-lock
Open

fix(demo): dispose sqlite persister before folder rename in wallet service#112
Ugarba202 wants to merge 1 commit into
bitcoindevkit:mainfrom
Ugarba202:fix/windows-wallet-service-file-lock

Conversation

@Ugarba202

Copy link
Copy Markdown

Summary

This PR resolves a Windows-specific filesystem locking bug (PathAccessException, errno 32) that occurs during SQLite database fallback migration and wallet reseeding in bdk_demo.

Context & Root Cause

On Windows, attempting to rename (Directory.rename) or delete (Directory.delete) a directory while an open file handle exists inside it throws OS Error: The process cannot access the file because it is being used by another process (errno = 32).

During wallet reseeding in WalletService._reseedWalletToPrimarySqlite and _reseedWalletToFallbackSqlite, Persister.newSqlite held an active file descriptor on bdk.sqlite when WalletStoragePaths.replaceWalletDataWithFallback (folder rename) or deleteFallbackWalletData was called.

This change ensures that persister and fallbackPersister are explicitly disposed before any folder renaming or deletion operations occur, matching the existing lifecycle pattern in _migrateWalletToSqliteIfMissing.

Related Issues

Checks Ran

  • just format (Formatted 86 files, zero formatting diffs)
  • just analyze (Zero static analyzer issues across core library)
  • just demo-analyze (No issues found! in bdk_demo)
  • just demo-test (bdk_demo unit and service verification suites)

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