{"record":{"id":"7dbb3acf2147162d","repo":"rustfs/rustfs","slug":"object-data-cache-ttl-secs-must-not-exceed-2592000","errorCode":null,"errorMessage":"object data cache ttl_secs must not exceed 2592000 seconds (30 days)","messagePattern":"object data cache ttl_secs must not exceed 2592000 seconds \\(30 days\\)","errorType":"validation","errorClass":"ObjectDataCacheConfigError","httpStatus":null,"severity":"error","filePath":"crates/object-data-cache/src/error.rs","lineNumber":45,"sourceCode":"\n    /// The configured entry size exceeds the moka weigher's u32 accounting range.\n    #[error(\"object data cache max_entry_bytes must stay below 4 GiB so the capacity weigher does not under-count entries\")]\n    MaxEntryBytesTooLarge,\n\n    /// The configured entry size cannot fit inside the explicit byte capacity.\n    #[error(\"object data cache max_entry_bytes plus weigher overhead must not exceed max_bytes\")]\n    MaxEntryBytesExceedsMaxBytes,\n\n    /// The configured entry size exceeds the resolved (derived) cache capacity.\n    #[error(\"object data cache max_entry_bytes must not exceed the resolved cache capacity\")]\n    MaxEntryBytesExceedsCapacity,\n\n    /// The configured time-to-live cannot be zero.\n    #[error(\"object data cache ttl_secs must be greater than 0\")]\n    ZeroTimeToLiveSecs,\n\n    /// The configured time-to-live exceeds the supported upper bound.\n    #[error(\"object data cache ttl_secs must not exceed 2592000 seconds (30 days)\")]\n    TimeToLiveTooLarge,\n\n    /// The configured time-to-idle cannot be zero.\n    #[error(\"object data cache time_to_idle_secs must be greater than 0\")]\n    ZeroTimeToIdleSecs,\n\n    /// The configured time-to-idle exceeds the supported upper bound.\n    #[error(\"object data cache time_to_idle_secs must not exceed 2592000 seconds (30 days)\")]\n    TimeToIdleTooLarge,\n\n    /// The configured minimum free memory percentage exceeded the supported range.\n    #[error(\"object data cache min_free_memory_percent must be in 1..=100\")]\n    InvalidMinFreeMemoryPercent,\n\n    /// The configured fill concurrency per CPU exceeded the supported range.\n    #[error(\"object data cache fill_concurrency_per_cpu must be greater than 0\")]\n    ZeroFillConcurrencyPerCpu,\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/rustfs/rustfs/blob/35af688cd9d41b4346fbe27dcf7250ba72046c1f/crates/object-data-cache/src/error.rs#L27-L63","documentation":"ObjectDataCacheConfigError::TimeToLiveTooLarge fires when ttl exceeds MAX_DURATION_SECS = 2592000 (30 days). The cap bounds how long an entry can outlive configuration changes and restarts; extremely long TTLs also interact with moka's internal time arithmetic, so validate() (config.rs:208-210) rejects them.","triggerScenarios":"validate() with ttl.as_secs() > 2_592_000: e.g. setting a year-long TTL (31_536_000), or accidentally configuring seconds where days were intended (365 days entered as 31536000 seconds is fine, but '999999' style values cross the cap).","commonSituations":"'Cache forever' intent expressed as a huge TTL instead of the appropriate mode; unit confusion (minutes vs seconds) inflating the value; copying a TTL from a system with no upper bound.","solutions":["Bring ttl to 2592000 seconds (30 days) or less; if data is effectively immutable, 30 days with re-fill on miss behaves nearly the same.","Double-check the unit the config field expects (seconds) and convert your intended wall-clock time correctly.","If you need permanent residency, evaluate whether an explicit capacity with time_to_idle serving as the reclamation mechanism meets the requirement."],"exampleFix":"// before\nttl: Duration::from_secs(365 * 24 * 3600), // one year -> TimeToLiveTooLarge\n\n// after\nttl: Duration::from_secs(30 * 24 * 3600), // 30 days, at the cap","handlingStrategy":"validation","validationCode":"const MAX_DURATION_SECS: u64 = 2_592_000;\nif cfg.ttl.as_secs() > MAX_DURATION_SECS {\n    return Err(format!(\"ttl must not exceed {} seconds\", MAX_DURATION_SECS));\n}","typeGuard":"fn is_ttl_too_large(err: &ObjectDataCacheConfigError) -> bool {\n    matches!(err, ObjectDataCacheConfigError::TimeToLiveTooLarge)\n}","tryCatchPattern":"if let Err(ObjectDataCacheConfigError::TimeToLiveTooLarge) = cfg.validate() {\n    // clamp ttl to <= 30 days; near-immutable data re-fills on miss anyway\n}","preventionTips":["Clamp user-supplied durations to the 30-day ceiling in the config layer.","Annotate config fields with their unit (seconds) and bounds."],"tags":["rust","object-data-cache","config-validation","ttl","cache-expiry"],"backgroundTag":"cache-config-validation-failed","analyzedSha":"35af688cd9d41b4346fbe27dcf7250ba72046c1f","analyzedAt":"2026-08-20T21:57:04.799Z","contentChangedAt":"2026-08-20T21:57:04.799Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}