GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: retry the cache info rename while Windows reports the file in use by mtallenca · Pull Request #537 · Baseflow/flutter_cache_manager

Conversation

@mtallenca

@mtallenca mtallenca commented Oct 2, 2026

Copy link
Copy Markdown

✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)

Bug fix.

⤵️ What is the current behavior?

On Windows, JsonCacheInfoRepository's atomic write (temp file + rename, since 3.4.3) fails with PathAccessException: Cannot rename file ... (OS Error: The process cannot access the file because it is being used by another process, errno = 32) whenever another process has the cache info file or the fresh temp file open without delete sharing. Antivirus and the search indexer routinely do that just after a file is written. The write is reported through FlutterError and stays pending until the next change, so it's lost if the app exits first. We see this in production at app startup.

🆕 What is the new behavior (if this is a feature change)?

When the rename fails with ERROR_SHARING_VIOLATION (32) or ERROR_ACCESS_DENIED (5), it's retried four times, with pauses of 50, 100, 200 and 400 ms (about 750 ms in all), before the failure is reported as before. Other errors are not retried.

💥 Does this PR introduce a breaking change?

No

🐛 Recommendations for testing

New tests use a forwarding file system whose rename fails a set number of times: a refusal that clears is retried and persisted with no error reported, persistent refusals are reported after five attempts, and other error codes are not retried. The first two fail without the change. flutter test, flutter analyze and dart format --set-exit-if-changed . pass locally. Not run on a Windows machine with a real file lock.

📝 Links to relevant issues/docs

MoveFileEx (used by File.rename on Windows), system error codes.

🤔 Checklist before submitting

  • All projects build
  • Follows style guide lines (code style guide)
  • Relevant documentation was updated
  • Rebased onto current main
  • Version bumped and dated CHANGELOG entry added

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mtallenca
fix: retry the cache info rename while Windows reports the file in use
55882a7
JsonCacheInfoRepository writes through a temp file and renames it over the
cache info file. Windows refuses that rename while another process holds
either file open without delete sharing, which antivirus and the search
indexer routinely do just after a file is written, so the write failed
with ERROR_SHARING_VIOLATION and stayed pending until the next change.

The rename is now retried a few times, about 750ms in all, when it fails
with ERROR_SHARING_VIOLATION (32) or ERROR_ACCESS_DENIED (5).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@mtallenca
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.