fix(tidy3d): FXC-5400-fix-local-cache-race-conditions#3227
Open
marcorudolphflex wants to merge 1 commit intodevelopfrom
Open
fix(tidy3d): FXC-5400-fix-local-cache-race-conditions#3227marcorudolphflex wants to merge 1 commit intodevelopfrom
marcorudolphflex wants to merge 1 commit intodevelopfrom
Conversation
6d80a70 to
c860582
Compare
Contributor
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
tidy3d/web/cache.pyLines 197-210 197 @contextmanager
198 def _with_interprocess_lock(self) -> Iterator[None]:
199 depth = getattr(self._file_lock_state, "depth", 0)
200 if depth > 0:
! 201 self._file_lock_state.depth = depth + 1
! 202 try:
! 203 yield
204 finally:
! 205 self._file_lock_state.depth -= 1
! 206 return
207
208 self._lock_path.parent.mkdir(parents=True, exist_ok=True)
209 self._root.mkdir(parents=True, exist_ok=True)
210 with self._file_lock: |
tylerflex
approved these changes
Feb 5, 2026
Collaborator
tylerflex
left a comment
There was a problem hiding this comment.
Fixed the
ERROR: Failed to fetch cache results: [Errno 2] No such file or
directory: '/Users/twhughes/.cache/tidy3d/simulations/stats.tmp' ->
'/Users/twhughes/.cache/tidy3d/simulations/stats.json'
for me, thanks @marcorudolphflex !
btw I'm on Mac.
15a14bc to
e8b68c1
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
9354aae to
8ccfb03
Compare
8ccfb03 to
9ab4c55
Compare
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.
stats.jsonwrites to unique temp files to avoid collisions.Note
Medium Risk
Touches core caching I/O and locking behavior; while changes are localized, mistakes could deadlock or regress cache performance/consistency under concurrency.
Overview
Fixes local result cache corruption when multiple processes update the same cache directory.
LocalCachenow wraps entry-point operations (list,clear,_fetch,_store,invalidate,sync_stats, etc.) in a combined in-process + inter-processfilelock-based lock with a single, explicit lock boundary (helpers assume the lock is already held).stats.json(and other metadata) writes now use per-process unique temp filenames beforeos.replace, avoiding tmp-file collisions.Adds multiprocessing regression tests that force concurrent
_store/invalidate/ stats updates, and updates dependencies (filelockadded to core deps; lockfile changes inpoetry.lock). CHANGELOG notes the local cache race fix.Written by Cursor Bugbot for commit 9ab4c55. This will update automatically on new commits. Configure here.