Skip to content

feat(serverless): log VolumeCache hydrate range retries - #709

Merged
deanq merged 2 commits into
mainfrom
deanq/sls-995-volume-cache-retry-logging
Nov 11, 2026
Merged

deanq merged 2 commits into
mainfrom
deanq/sls-995-volume-cache-retry-logging

Conversation

@deanq

@deanq deanq commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

VolumeCache hydrate now logs its range retries and reports retry and failure counts. A volume that rejects metadata updates now produces one EPERM log line per operation instead of one per file.

Why

Hydrate retries a byte range up to 8 times, with backoff, on ENOMEM/EIO/EAGAIN, and it logged nothing when it did. A hydrate slowed down by FUSE (geesefs) pressure couldn't be diagnosed from logs; benchmarking had to monkeypatch _copy_range just to count retries.

Changes

  • Per-retry debug line: VolumeCache: retrying <src> at offset <off> after ENOMEM (attempt N/8).
  • Warning: a hydrate logs one warning when it passes _HYDRATE_RETRY_WARN_THRESHOLD = 64 range retries. Isolated retries are normal on object-store mounts and stay at debug level. Past this point backoff is materially slowing the hydrate.
  • Summary: the existing hydrated N file(s) line now ends with (range retries: R, ranges given up: G). It is also logged when retries or failures happened but no file was restored; that case used to log nothing. hydrate() still returns the file count, so the API is unchanged.
  • Counters: a per-hydrate _HydrateStats object holds them, guarded by a lock because ranges copy in parallel. Its as_dict() is meant to be folded into structured metrics later. The instrumentation never raises into the caller.
  • Given-up count: a range counts as given up when it fails for good, either because retries ran out or because the error isn't transient. One failed file counts once, because its remaining ranges are skipped.
  • Metadata EPERM: a per-operation _MetadataPolicy records the first EPERM from utime/chmod, logs it once, and skips both calls for the rest of that sync or hydrate. Errors other than EPERM are still logged per file. Reconciliation compares against the metadata recorded in the manifest, so skipping these calls is safe.
  • Docs: docs/serverless/volume_cache.md has a new "Logging" section.

Test plan

  • 12 new tests; OS errors are injected at os.pread / os.utime / os.chmod:
    • Retry logging: one debug line per retry, with errno, attempt, file and offset.
    • Summary counts: correct for clean runs, for retries, for exhausted retries and for non-retryable errors.
    • Warning threshold: fires exactly once above the threshold and not at it.
    • Concurrency: counts are exact with 16 parallel workers and 40 injected errors, and the files are byte-exact.
    • Failing instrumentation: a hydrate still succeeds when logging itself raises.
    • EPERM: logged once per operation (including the chmod-only case), detected fresh for each operation, and other metadata errors still logged per file.
  • make quality-check: 2835 passed, coverage 94.39%
  • Watch logs from a hydrate on a Global Store mount under load

@deanq
deanq requested review from a team and KAJdev and a balanced review from Copilot November 10, 2026 20:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Concurrent range failures can overcount failed files, metadata rejection can prevent manifest mtime restoration, and parallel sync races can make syscall-count tests flaky.

3 open issues
What changed in this PR

This PR improves VolumeCache observability for slow or failed hydrates and reduces repeated metadata-permission logging on network volumes.

Changes:

  • Adds per-range retry logs, a retry-threshold warning, and retry/failure counts in hydrate summaries.
  • Introduces per-operation metadata handling to suppress repeated EPERM logs and metadata calls.
  • Adds tests for retry instrumentation, concurrency, and metadata failures, plus logging documentation.
File Description
tests/​test_serverless/​test_utils/​test_rp_volume_cache.py Adds retry-count, logging, concurrency, and metadata-error tests.
runpod/​serverless/​utils/​rp_volume_cache.py Implements hydrate statistics, retry logging, and shared metadata policy.
docs/​serverless/​volume_cache.md Documents retry summaries, warnings, and EPERM handling.

Review effort: Balanced

@deanq
deanq force-pushed the deanq/sls-995-volume-cache-retry-logging branch 3 times, most recently from 7366df7 to c7934f9 Compare November 10, 2026 22:54
Hydrate retried transient FUSE errors silently, so a hydrate slowed
by geesefs pressure could not be diagnosed from logs.

- Log each range retry at debug with errno, attempt, file, offset
- Warn once when a hydrate passes 64 range retries
- Add range retries and ranges given up to the hydrate summary log
- Detect metadata EPERM once per sync/hydrate and skip later
  utime/chmod calls instead of logging a debug line per file
- count a failed hydrate file once, not once per in-flight range
- track metadata EPERM per op so a chmod rejection no longer stops
  later files from getting the manifest mtime
- pin single-worker sync in the two EPERM syscall-count tests
@deanq
deanq force-pushed the deanq/sls-995-volume-cache-retry-logging branch from eae06bb to 5145298 Compare November 11, 2026 00:51
@deanq
deanq merged commit ed053b2 into main Nov 11, 2026
9 checks passed
@deanq
deanq deleted the deanq/sls-995-volume-cache-retry-logging branch November 11, 2026 19:08
@promptless

promptless Bot commented Nov 11, 2026

Copy link
Copy Markdown

Promptless documentation updates

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.

3 participants