Skip to content

Conversation

@majiayu000
Copy link

Fix: Reduce duplicate log messages when VFS cache runs out of space

Summary

When the VFS cache runs out of disk space, rclone generates excessive duplicate log messages that can rapidly fill up log files and make debugging difficult. This fix implements rate limiting and deduplication for out-of-space error messages across the VFS cache subsystem, significantly reducing log noise while preserving essential diagnostic information.

Changes Made

vfs/vfscache/cache.go

  • Changed log level for "ready to kick cleaner" message from Logf to Debugf to reduce noise during normal cache cleanup operations

vfs/vfscache/downloaders/downloaders.go

  • Added lastOutOfSpaceLog field to track when out-of-space messages were last logged
  • Modified _countErrors to only log every 5th error for out-of-space conditions, reducing repetitive messages during sustained space pressure
  • Added rate limiting to kickWaiters to log out-of-space errors at most once per 10 seconds

vfs/vfscache/item.go

  • Added firstError tracking variable in ReadAt retry loop
  • Modified retry logic to only log "failed to _ensure cache" error on the first occurrence rather than on every retry attempt

Testing

  • Manual testing with a cache directory on a small filesystem to verify log output is reduced when space is exhausted
  • Verified that initial errors are still logged for debugging purposes
  • Confirmed that periodic status updates (every 5 errors, every 10 seconds) still provide visibility into ongoing issues

Fixes

Fixes #4998

Checklist

  • Tests pass locally
  • Code follows project style guidelines
  • No breaking changes

Fixes rclone#4998

Signed-off-by: majiayu000 <1835304752@qq.com>
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.

Mount: When the cache space is insufficient, repeated strings will be generated in the log file.

1 participant