[BUG] Keep the curl retry deadline stable within an attempt - #4452
[BUG] Keep the curl retry deadline stable within an attempt#4452shixi-li wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4452 +/- ##
==========================================
+ Coverage 82.63% 82.85% +0.23%
==========================================
Files 512 512
Lines 20138 20145 +7
==========================================
+ Hits 16639 16690 +51
+ Misses 3499 3455 -44
🚀 New features to boost your workflow:
|
|
the defect is real. one correction to the description. "biased toward the lower end" is not the mechanism, and at the first attempt with defaults it is not the direction either. simulating the release rule at the default 256ms
at 1s the mean goes up, because poll quantisation dominates when the backoff is only four polls wide. the low bias appears once the backoff grows past that, and sharpens as the poll interval shrinks relative to it. the band narrowing is the part worth citing. the rename is contained, |
There was a problem hiding this comment.
reviewed the retry path against main. the deadline caching looks right and the tests cover what the issue described.
the one inline note is about the NextRetryTime() fallback. the reason I am raising it rather than letting it go is a second change this PR makes that the description does not mention.
IsRetryable() moves from after the DispatchEvent sequence to before it. previously the value computed inside PerformCurlMessage and the one the scheduler computes at http_client_curl.cc:539 sat on the same side of the
event handlers. now three synchronous dispatches run between them. i cannot find anything in tree that breaks the agreement between those two calls, so this is not a bug report. it is that the invariant the fallback quietly relies on is
weaker after this change than before it, which is why i would rather the fallback were a deliberate choice than a leftover.
one question on coverage: with ENABLE_OTLP_RETRY_PREVIEW off, IsRetryable() returns false unconditionally and the whole reordered block is a no op. are the new tests running under a job that defines it, or only locally?
| return next_retry_time_point_; | ||
| } | ||
|
|
||
| return CalculateNextRetryTime(); |
There was a problem hiding this comment.
this fallback is the behaviour #4403 describes, recomputing a fresh jittered value on every call.
i think it is unreachable as written. http_client_curl.cc:870 is the only non test caller and it only walks pending_to_retry_sessions_, which is filled at http_client_curl.cc:539 behind operation->IsRetryable(). whenever is_retryable is true this PR always stores a deadline, either the parsed
Retry-After or CalculateNextRetryTime() at line 1606. so nothing reaches the fallback and the old behaviour survives in a branch nothing exercises.
would you rather drop it so a missing deadline surfaces as a visible bug, or keep it with an assert naming the invariant? see the summary for why the invariant is worth naming.
Fixes #4403
NextRetryTime()drew a new jitter sample on every call, so polling the same retryable request moved its deadline and biased the realized delay toward the lower end of the backoff band.Changes
Responseevent and reuse it for schedulingRetry-Afterdeadlines and use one stable jittered backoff when the header is missing or invalidFor significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changesTests
curl_http_testsuite./ci/do_ci.sh cmake.maintainer.sync.test./ci/do_ci.sh cmake.test./ci/do_ci.sh cmake.exporter.otprotocol.test./ci/do_ci.sh formatmarkdownlint .Coverage notes
The focused cases exercise the shared completion path through synchronous
Send(). The existing full client suites cover async operation, but this change does not add an end-to-end timing assertion for the pending retry queue. Existing HTTP-date and over-max-backoffRetry-Afterbehavior is unchanged. Local runtime validation was on Linux/amd64.