Repository navigation
Refuse a timer-backed timing longer than about 49.7 days [patch] - #122
Open
matt-edmondson wants to merge 1 commit into
Open
matt-edmondson wants to merge 1 commit into
matt-edmondson wants to merge 1 commit into
Conversation
FetchTimeout, DiffTimeout, ProbeTimeout and MaintenanceInterval were only checked to be positive, but they are handed to CancellationTokenSource, Task.WaitAsync and PeriodicTimer, which throw ArgumentOutOfRangeException past uint.MaxValue - 1 milliseconds. A value such as 365.00:00:00 meant as "effectively no timeout" passed validation and then stopped startup with a raw exception, or made every request needing a fetch or diff fail with a 500. The validator now refuses it with a message naming the setting, the value and the limit. Fixes #121 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5wqHMdBMn6Wino1eH
|
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.



Fixes #121
What changed
FetchTimeout,DiffTimeout,ProbeTimeoutandMaintenanceIntervalwere only checked to be positive. They are passed toCancellationTokenSource,Task.WaitAsyncandPeriodicTimer, and all three throwArgumentOutOfRangeExceptionpastuint.MaxValue - 1ms (about 49.7 days).The validator now refuses those four settings above
MaxTimerDuration(TimeSpan.FromMilliseconds(uint.MaxValue - 1)). The failure message names the setting, the value and the limit, the same way a non-positive value or a relativeMirrorRootis already refused. The check sits next toRequirePositive, in a newRequirePositiveTimerDuration.RefsTtlandAdmissionTtlnever reach a timer, so they are unchanged.Tests
Validate_TimerSettingOf49Days_Succeedschecks that each of the four settings accepts 49 days.Validate_TimerSettingOf50Days_Failschecks that each of the four refuses 50 days, with the setting name and the limit in the message. These four cases fail when the bound is neutralised.MaxTimerDuration_IsTheLongestDurationTheTimersAcceptpins the constant against the real APIs: the maximum is accepted, and 1 ms more throws for bothCancellationTokenSourceandPeriodicTimer.The full suite passes (317 tests).
Generated by Claude Code