Skip to content

Conversation

@jamescrosswell
Copy link
Collaborator

@jamescrosswell jamescrosswell commented Sep 5, 2025

Resolves #2033, Resolves #1067

Todo

We're seeing an error in some entirely unrelated code on Windows ARM64. This is happening for other PRs as well, so unrelated to this PR.

Interprocess Locking

This turns out to be surprisingly difficult.

Something like a named Mutex could be used for this. However Mutexes are thread affine so they need to be released on the same thread that acquired them. Other than setting aside a dedicated thread for the lifetime of the Hub, there's no easy way to make that work.

A named Semaphore would be another option, but these aren't supported on macOS.

In the end I went with the "lock file" solution that @lucas-zimerman suggested. Keeping a lock file specific to each cache directory and opening this with FileShare.None gives us a kind of file based named mutex that we can use to avoid having multiple instances of the Hub trying to process files from the same cache directory.

@jamescrosswell jamescrosswell marked this pull request as ready for review September 11, 2025 22:25
cursor[bot]

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Sep 11, 2025

Codecov Report

❌ Patch coverage is 77.16049% with 37 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (version6@522f80e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/Sentry/Internal/Http/CachingTransport.cs 70.73% 19 Missing and 5 partials ⚠️
src/Sentry/Internal/CacheDirectoryCoordinator.cs 81.96% 9 Missing and 2 partials ⚠️
src/Sentry/Internal/ReadOnlyFilesystem.cs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             version6    #4498   +/-   ##
===========================================
  Coverage            ?   73.36%           
===========================================
  Files               ?      482           
  Lines               ?    17567           
  Branches            ?     3473           
===========================================
  Hits                ?    12888           
  Misses              ?     3826           
  Partials            ?      853           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bruno-garcia
Copy link
Member

@sentry review

@jamescrosswell jamescrosswell merged commit 570eae6 into version6 Nov 12, 2025
14 of 15 checks passed
@jamescrosswell jamescrosswell deleted the isolated-cache branch November 12, 2025 08:28
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.

Offline caching should support concurrent process instances Errors when initializing Sentry twice with caching enabled

5 participants