Skip to content

fix(rolldown): bound reader cache retention by log size - #593

Draft
hyoban wants to merge 2 commits into
vitejs:mainfrom
hyoban:fix/rolldown-reader-cache
Draft

hyoban wants to merge 2 commits into
vitejs:mainfrom
hyoban:fix/rolldown-reader-cache

Conversation

@hyoban

@hyoban hyoban commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

Switching between large Rolldown traces retains up to 32 readers regardless of trace size. This can keep multiple multi-GiB sessions' parsed data alive after their requests finish.

Add a 256 MiB source-log-size budget alongside the existing reader count limit, evicting the least recently used idle readers. Account for source size even when restoring disk caches, and prune again when reads settle. Readers in the current session directory and pending reads remain available, so oversized or concurrent sessions can exceed the budget; source size is a cache weight, not a heap measurement.

Eviction drops cache ownership without clearing data that RPC handlers may still use. Disposing an evicted reader also checks its identity before removing the cache entry, preserving any replacement for the same path.

Linked Issues

None.

Additional context

Adds 10 regression cases covering LRU eviction, oversized sessions, count limits, retained caller data, replacement disposal, disk-cache restoration, and pending reads across all three read modes. All 10 fail on the previous implementation and pass with this change. Three additional regressions exercise RolldownLogsManager.loadSession, loadSessionSummary, and loadPackageSession with separate metadata files: loading metadata preserves the oversized log reader, repeated requests reuse it, and switching sessions still evicts it. These three cases fail with reader-only protection and pass with session-level protection.

Validation: pnpm lint, pnpm build, and pnpm test --run passed (355 passed, 2 skipped). pnpm typecheck reports the same eight existing Nuxt/Vite plugin type errors as unmodified 59260bfd.

This is independent of #592, which bounds bulk reads during plugin detail hydration.

@pkg-pr-new

pkg-pr-new Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@593

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@593

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@593

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@593

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@593

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@593

commit: 3eba06a

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.

1 participant