Skip to content

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Oct 30, 2025

Canonicalized path was dropped error started to happen when I started to call resolver.cache_clear() frequently (so that I can clear the cache for each resolution to support vitest-dev/vitest#8754 (comment)).

My guess of the cause is:

This PR solves that by using Mutex<Weak<_>>> instead of OnceLock<Weak<_>>. Since weak.upgrade() may return None, I changed the code to resolve when weak returned None. The previous code assumed that weak.upgrade() always returns a value and that allowed us to use OnceLock.

I guess this will have a negative impact on perf...

@graphite-app
Copy link

graphite-app bot commented Oct 30, 2025

How to use the Graphite Merge Queue

Add the label merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

❌ Patch coverage is 82.75862% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.70%. Comparing base (9de3088) to head (3fbd440).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/cache/cache_impl.rs 82.14% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #791      +/-   ##
==========================================
+ Coverage   93.59%   93.70%   +0.10%     
==========================================
  Files          17       17              
  Lines        3093     3081      -12     
==========================================
- Hits         2895     2887       -8     
+ Misses        198      194       -4     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 30, 2025

CodSpeed Performance Report

Merging #791 will not alter performance

Comparing fix/dont-drop-canonicalized-path-by-cache-clear (3fbd440) with main (9de3088)

Summary

✅ 10 untouched
⏩ 5 skipped1

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Boshen
Copy link
Member

Boshen commented Nov 1, 2025

This PR has not been forgotten, I'm still seeking a better solution.

@Boshen Boshen marked this pull request as draft November 1, 2025 14:33
@Boshen
Copy link
Member

Boshen commented Nov 1, 2025

What I have found so far after fighting with Claude:

... Told Claude to add tests to expose the bug. Logic is valid, but couldn't replicate, until I told it understand what papaya is doing, then told it to switch to DashMap.

The failing test clearly shows:
BUG: Canonicalization failed with 'Canonicalized path was dropped' after
clear_cache().
This happens because the OnceLock still has a cached weak reference, but
clear_cache()
removed the strong reference from cache.paths.

Why DashMap exposed the bug:

  • Papaya uses epoch-based memory reclamation - strong references aren't
    immediately dropped
  • DashMap immediately drops entries when clear() is called - weak references
    immediately become invalid

@Boshen Boshen marked this pull request as ready for review November 2, 2025 04:35
@Boshen
Copy link
Member

Boshen commented Nov 2, 2025

Ok I can't figure out a better to solve this, merging.

@Boshen Boshen merged commit cc28e95 into main Nov 2, 2025
18 checks passed
@Boshen Boshen deleted the fix/dont-drop-canonicalized-path-by-cache-clear branch November 2, 2025 04:36
@Boshen Boshen mentioned this pull request Oct 31, 2025
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.

3 participants