Skip to content

vfs: add --vfs-downloader-idle-time and --vfs-downloader-max-errors - #10171

Merged
ncw merged 2 commits into
rclone:masterfrom
A-RYAN-1:feat/10148-vfs-downloader-flags
Nov 12, 2026
Merged

ncw merged 2 commits into
rclone:masterfrom
A-RYAN-1:feat/10148-vfs-downloader-flags

Conversation

@A-RYAN-1

Copy link
Copy Markdown
Contributor

What does this change do?

Makes the two VFS cache downloader limits from #10148 configurable. --vfs-downloader-idle-time is how long a downloader can sit idle before it stops (default 5s) and --vfs-downloader-max-errors is how many errors it tolerates before giving up (default 10). Both defaults are the old constants, so nothing changes unless the flags are set.

Streaming slowly with --vfs-cache-mode full and --buffer-size 0 can leave more than 5s between reads, so the downloader stops with "stopping download thread as it timed out" and has to start again.

Two new tests in vfs/vfscache/downloaders: one sets the idle time to 50ms and checks an idle downloader stops, the other checks the error limit is read from the options, both when it is exceeded and when it is not. The vfs docs have a short paragraph on the two flags. Open point: I added a dedicated error limit rather than reusing --low-level-retries as the issue suggests, because the downloader counts errors across reads, not retries of one call. Say if you would rather reuse it.

Linked issue

Fixes #10148

Checklist

  • This change is trivial OR it has been discussed and agreed in the linked issue.
  • I have read the contribution guidelines.
  • (If I used AI tools to help write this code) I have read and understood the AI-assisted contributions guidance, and I have tested and take ownership of this change myself.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • This Pull Request is ready for review.

…ixes rclone#10148

The idle time after which a cache downloader stops and the number of errors it tolerates were fixed at 5s and 10. A slow reader, such as audio streamed with --buffer-size 0, could see its downloader time out between reads, and a failing backend kept a mount busy until the error count was reached.
@A-RYAN-1
A-RYAN-1 requested a review from ncw as a code owner October 22, 2026 17:37
@A-RYAN-1

Copy link
Copy Markdown
Contributor Author

Friendly ping on this one: the ./vfs/... tests pass locally, with tests added for both flags. A first review whenever you have time would be great, and I can rename the flags if you prefer different names.

@A-RYAN-1

Copy link
Copy Markdown
Contributor Author

The only red job is linux_386, which stopped part-way through backend/drive with no failing test, while the other platforms pass and ./vfs/... passes locally. A re-run of that job would confirm, and a first review is welcome whenever there is time. Thank you.

@A-RYAN-1

Copy link
Copy Markdown
Contributor Author

The only red check is linux_386, from TestS3Minio in cmd/serve/s3, which this change does not touch. Could a maintainer re-run it and review? Thank you.

@A-RYAN-1

Copy link
Copy Markdown
Contributor Author

A quick check-in on this one. I am happy to rename the flags or change the defaults if you prefer, and to look at the one failing linux_386 job if it traces back to this change. Thank you.

@A-RYAN-1

A-RYAN-1 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Friendly ping for a review when someone has time. I am glad to rename the flags or change the defaults if you prefer different ones.

@A-RYAN-1

Copy link
Copy Markdown
Contributor Author

Still waiting on a first review here. The branch is current and every check except the linux_386 one is green; that one is TestS3Minio, which does not touch these flags. Happy to rename the flags or change defaults if that helps.

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice - thank you :-)

Apart from some quibble about names this is ready to go - see inline!

Comment thread vfs/vfscommon/options.go Outdated
Help: "Time a cache downloader can be idle before it stops",
Groups: "VFS",
}, {
Name: "vfs_downloader_max_errors",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be called vfs_cache_downloader_max_errors

Comment thread vfs/vfscommon/options.go Outdated
Help: "Extra read ahead over --buffer-size when using cache-mode full",
Groups: "VFS",
}, {
Name: "vfs_downloader_idle_time",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be called vfs_cache_downloader_idle_time

Comment thread vfs/vfs.md Outdated
When using this mode it is recommended that `--buffer-size` is not set
too large and `--vfs-read-ahead` is set large if required.

A downloader which is not read from for `--vfs-downloader-idle-time`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update flag names here

Comment thread vfs/vfscommon/options.go Outdated
WriteBack fs.Duration `config:"vfs_write_back"` // time to wait before writing back dirty files
ReadAhead fs.SizeSuffix `config:"vfs_read_ahead"` // bytes to read ahead in cache mode "full"
DownloaderIdleTime fs.Duration `config:"vfs_downloader_idle_time"` // time a downloader can be idle before it stops
MaxDownloadErrors int `config:"vfs_downloader_max_errors"` // errors a downloader tolerates before giving up

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make name consistent with flag so DownloaderMaxErrors

The flags are now --vfs-cache-downloader-idle-time and --vfs-cache-downloader-max-errors, and the option field is DownloaderMaxErrors, to match the other vfs cache options.
@A-RYAN-1

Copy link
Copy Markdown
Contributor Author

Thanks, all renamed in 97b5114: the flags are now --vfs-cache-downloader-idle-time and --vfs-cache-downloader-max-errors, the option field is DownloaderMaxErrors, and vfs.md uses the new names. The vfs tests pass.

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great now - thank you :-)

@ncw
ncw merged commit 2033adc into rclone:master Nov 12, 2026
9 checks passed
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.

Add command line args to control VFS downloader settings: maxDownloaderIdleTime, maxErrorCount

2 participants