The process cannot access the file because it is being used by another process – TortoiseGit status cache under concurrent requests
0 reputation · 13 Jan 2025, 19:46 UTC
0 reputation · 13 Jan 2025, 19:46 UTC
Goal: Determine the exact concurrency threshold at which TortoiseGit's shared status cache begins to exhibit file‑system lock contention that triggers Windows error 32.
Constraints: Working copy larger than 10 000 files, status cache set to the default (shell) mode, real‑time antivirus scanning the .git directory, and simultaneous launch of TortoiseGit context menus, commit dialogs, or log views.
Uncertainty: Whether adjusting the cache refresh interval, limiting parallel overlay requests, or excluding specific file patterns can reduce lock duration without disabling icon overlays.
Questions: What is the maximum number of simultaneous TortoiseGit UI operations that can be performed before lock contention appears? Does reducing the status cache refresh interval lower the probability of error 32 while preserving overlay accuracy? Can excluding the .git/index file from antivirus real‑time scanning eliminate the latency without disabling the status cache?
29775 reputation · 14 Jan 2025, 01:38 UTC
There is no exact concurrency threshold and no documented maximum number of simultaneous TortoiseGit UI operations. Windows error 32 is a sharing violation: another process holds a file—most often .git/index—in a way that conflicts with the requested access. On a working copy larger than 10,000 files with real-time antivirus scanning .git, contention may appear with only a handful of simultaneous context menus, commit dialogs, or log views, but that is an environment-specific symptom pattern, not a fixed limit.
Reducing the status cache refresh interval—making scans more frequent—generally does not lower the probability of error 32. Increasing the interval can lower it by reducing background scan frequency, at the cost of stale overlays. Excluding the exact .git/index path from real-time antivirus scanning can remove the dominant lock source and preserve icon overlays, provided antivirus is the lock holder.
Confirmed: error 32 means a conflicting open handle exists. TortoiseGit's shell status cache and icon overlays read working-copy metadata, including .git/index, to compute status. Concurrent UI operations can trigger multiple cache or status reads. A repository with more than 10,000 files makes each status pass longer, widening the collision window.
Likely, but not confirmed for your machine: real-time antivirus scanning .git/index is the external lock that extends the critical section. TortoiseGit's cache may serialize its own requests, but it cannot control antivirus, Windows Search, backup agents, or other Git processes. The exact number of simultaneous UI operations at which error 32 appears is therefore not portable.
Ask one missing diagnostic detail: when error 32 occurs, which process holds .git/index? That changes the recommendation.
\.git\index; Operation is CreateFile; Result is SHARING VIOLATION. Reproduce with three to five simultaneous TortoiseGit UI operations.TortoiseGitCache.exe or git.exe, tune cache concurrency or refresh instead.handle.exe -a "C:\path\to\repo\.git\index" (Sysinternals, elevated). This shows current holders, not the full sharing-violation history.Exclude the exact repository's .git\index from real-time scanning. If that works, consider also excluding .git\objects and .git\HEAD for that repository, but keep the exclusion narrow. This preserves icon overlays and the status cache. Security tradeoff: excluded paths are not scanned in real time; scope the exclusion to a trusted working copy, not all of C:\.
Increase the status-cache refresh interval rather than shortening it. A longer interval means fewer background scans and shorter aggregate lock windows, but overlays may not reflect external changes until the next scan. In TortoiseGit settings, look under Icon Overlays or Status Cache for the refresh interval; the exact label varies by version. Test 30 seconds or more.
Some TortoiseGit builds reportedly support an undocumented per-user CacheMaxParallel DWORD under HKCU\Software\TortoiseGit. Treat this as version-dependent and verify before relying on it. To inspect:
reg query "HKCU\Software\TortoiseGit" /v CacheMaxParallelIf present, setting it to 2 and restarting explorer.exe can throttle parallel overlay requests. Do not assume it exists in your version.
Do not disable icon overlays as the first move. Excluding the index file and lengthening the refresh interval usually preserve overlays. If error 32 persists after antivirus exclusion, check Windows Search indexing, backup tools, and any Git GUI or IDE that scans the same working copy.
Repeat the same concurrent UI scenario after each change. Compare Process Monitor sharing-violation counts for .git\index. A drop in violations with acceptable overlay freshness is success. If the lock holder changes, revisit the fix. Assumption: TortoiseGit 2.x on Windows with the shell status cache; exact settings labels and undocumented registry values require verification for your build.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.