Repository navigation
Conversation
When the VFS cache runs out of space and download retries occur, error messages grow exponentially because each retry wraps the previous error with the same "vfs reader: failed to write to cache file:" prefix. This happens because kickWaiters() propagates the lastErr (from a previous download attempt) back through Write(), and download() wraps it again unconditionally. After ~243 retries the error message contains the prefix repeated 243 times, causing massive log files (reported in issue rclone#4998). Fix by checking whether the error already contains the wrapping prefix before adding it again in download(). Extract the prefix string into a named constant to keep the check DRY. Fixes rclone#4998 Co-Authored-By: Claude (claude-opus-4-6) <[email protected]>
actuallyevan
approved these changes
Mar 28, 2026
Member
|
I'm closing this in favor of #9776 - sorry we didn't get round to merging this. |
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.
Summary
Fixes #4998
When the VFS cache runs out of disk space (or encounters repeated download errors), each retry in the downloader wraps the previous error with the same
"vfs reader: failed to write to cache file:"prefix. This happens because:download()wraps any error fromWriteTo()with the prefixlastErrviacountErrors()kickWaiters()propagateslastErrback throughWrite()as the return errorWriteTo()returns this error todownload(), which wraps it againAfter ~243 retries, the error message contains the prefix repeated 243 times, producing log lines that are tens of kilobytes long and causing massive log file growth.
Fix
In
download(), check whether the error already contains the"vfs reader: failed to write to cache file"prefix before wrapping it again. The prefix string is extracted into a named constant (errCacheWritePrefix) to keep the check DRY.This is a minimal, targeted fix that prevents the exponential error message growth while preserving the full error chain for the first occurrence.
Test plan
go build ./vfs/vfscache/downloaders/compiles cleanlygo test ./vfs/vfscache/downloaders/passes (6.764s)--vfs-cache-mode=fulland a small--vfs-cache-max-size, trigger cache-full condition, verify log messages no longer grow exponentially