-
-
Notifications
You must be signed in to change notification settings - Fork 34
fix: don't drop canonicalized path by cache clear #791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
How to use the Graphite Merge QueueAdd 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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
CodSpeed Performance ReportMerging #791 will not alter performanceComparing Summary
Footnotes
|
|
This PR has not been forgotten, I'm still seeking a better solution. |
|
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: Why DashMap exposed the bug:
|
|
Ok I can't figure out a better to solve this, merging. |
Canonicalized path was droppederror started to happen when I started to callresolver.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:
resolver.cache_clear()is called while a resolution is happeningself.pathsis cleared because of that callArc::downgraderemoves the last strong reference:oxc-resolver/src/cache/cache_impl.rs
Line 283 in 9de3088
weak.upgrade()errors:oxc-resolver/src/cache/cache_impl.rs
Line 288 in 9de3088
This PR solves that by using
Mutex<Weak<_>>>instead ofOnceLock<Weak<_>>. Sinceweak.upgrade()may return None, I changed the code to resolve whenweakreturned None. The previous code assumed thatweak.upgrade()always returns a value and that allowed us to useOnceLock.I guess this will have a negative impact on perf...