Skip to content

Give each --retry-on-error retry its own backoff - #700

Merged
fcostaoliveira merged 1 commit into
masterfrom
fix-696-retry-backoff-per-request
Oct 16, 2026
Merged

fcostaoliveira merged 1 commit into
masterfrom
fix-696-retry-backoff-per-request

Conversation

@fcostaoliveira

@fcostaoliveira fcostaoliveira commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Decisions for maintainers:

  1. Each retry waits its own backoff, retry-backoff-ms * factor^resends, where resends is the number of times that request has already been resent. That holds however many other requests share the connection's retry queue. The 60 s cap limits only the factor's growth: a --retry-backoff-ms above 60 s is used as is.
  2. New requests are held while queued retries plus requests in flight reach the retry queue cap, so a request that fails in flight always has room to retry. --pipeline still counts only requests in flight. --max-retry-queue stays the hard limit on the queue. The hold starts at max(cap, --pipeline), so a smaller --max-retry-queue cannot cut the pipeline on a healthy server. The guarantee then holds only for --max-retry-queue >= --pipeline, which includes the auto cap.

Problem

With --retry-on-error and --retry-backoff-factor > 1, the retry backoff keeps growing across requests. Setup: every SET fails (maxmemory 1, noeviction), flags -t1 -c1 --ratio=1:0 --retry-on-error --max-retries=5 --retry-backoff-ms=10 --retry-backoff-factor=2 --connection-stage-timeout=0. Then -n1 / -n2 / -n3 take 1 s / 4 s / 47 s, and a --test-time=8 run was still running at 100 s.

Root cause

There are two problems, both caused by keeping the retry state per connection instead of per request.

  1. One backoff value per connection. enqueue_retry() multiplied m_current_retry_backoff_ms by the factor on every queued retry, from any request. reset_retry_backoff() ran only when a retried request later succeeded. A request that gave up after --max-retries left the value inflated for the next request.
  2. One drain timer per connection, and it resent the whole queue. The timer was armed with the delay of whichever request found it idle, and when it fired it resent everything queued. With mixed outcomes, requests at different retry counts share a batch. A first retry rides a timer armed by a 4th retry, and a 4th retry rides one armed by a first retry. Review measured this on the first version of this PR (24c7bce). With 50% -TRYAGAIN, factor 4 and base 10 ms, the median first-retry gap was 640 ms. With 60% -LOADING and factor 2, 620 of 804 gaps were more than 1.5x the request's own backoff.

Fix

  • retry_backoff.h: new header-only retry_backoff_delay_ms(base_ms, factor, resends), which computes base_ms * factor^resends.
    • Factor 0 keeps the delay constant.
    • base_ms == 0 gives 0, so 0 * inf never happens.
    • The factor's growth stops at 60 s; inf is clamped too.
    • A base above 60 s is used as is.
  • enqueue_retry(): gives each queued request its own m_retry_due = now + delay. The connection keeps one timer, armed for the earliest due time (m_retry_timer_due). It is brought forward when a request with an earlier due time is queued, so a request sitting at the 60 s cap with --max-retries=-1 no longer holds the others back.
  • handle_retry_drain_event(): resends only the requests that are due, with 1 ms slack for timer/wall-clock skew. It keeps the rest queued in their original order and re-arms the timer for the next due time.
  • Removed: m_current_retry_backoff_ms, reset_retry_backoff() and its two callers in client.cpp.
  • Queue cap (fill_pipeline()): new work used to be held only once the retry queue was exactly full. Requests already in flight that then failed found it full, and enqueue_retry() gave them up with retries=0 even with --max-retries=4. Per-request backoffs keep requests in the queue longer, which made this about 10x more frequent. Now fill_pipeline() holds new requests while queued retries + requests in flight >= cap (auto cap max(pipeline*4, 64), or --max-retry-queue), so every request in flight has a free slot.
    • The cap still bounds the queue: enqueue_retry() still refuses when the queue is full. That can still happen for a MOVED/ASK redirect arriving from another connection.
    • --pipeline is unchanged: queued retries still do not count against it.
    • --max-retry-queue keeps its meaning: retry_queue_full() still uses the user's value as the hard limit. Only the hold in retry_queue_holds_new_work() uses max(cap, --pipeline). Otherwise requests in flight alone would reach a small cap and cut the pipeline on a healthy server.
      • Throughput with --pipeline=64 --max-retry-queue=4 against a healthy redis (-t1 -c1 --ratio=1:1, 4 s, pinned to one CPU): 53f0fcd made 94-113k ops/sec; this branch makes 455-457k, and master makes 451-499k.
      • The trade-off with an explicit --max-retry-queue below --pipeline: requests in flight beyond the cap have no guaranteed slot and can be given up early, as on master. With every SET failing, --pipeline=64 --max-retry-queue=4 --max-retries=3 -n640 gives up 632 of 640 at retries=0. With --max-retry-queue=64 it gives up none early.
    • The --max-retry-queue help text and man page used to say "the pipeline stops accepting new work when full". They now say what happens.
  • Retry left behind by a blocked drain (Cursor): if the drain timer fires while the connection cannot send yet, the due requests stay queued and the timer goes idle. The next enqueue_retry() used to arm the timer for its own, later due time. fill_pipeline() skips the drain while the timer is pending, so the overdue requests waited out the new request's backoff. Now, when the timer is idle and requests are already queued, m_retry_timer_due still holds their earliest due time, and enqueue keeps the timer armed for that earlier time.
  • Clock: due times use CLOCK_MONOTONIC, like the existing check in cluster_client.cpp, so a wall-clock step cannot stall or release queued retries. The old code passed only relative delays to the timer. The 1 ms slack in the drain only saves a timer wakeup.
  • Unchanged:
    • the errors/retries/failed-keys accounting;
    • disconnect() moving the retry queue into the replay queue and cancelling the timer;
    • the fill_pipeline hook that drains after setup;
    • --transaction requests are still refused.
    • MOVED/ASK redirects count as resends (m_retries), so they get the same backoff as any other retry.
  • Cap change: --retry-backoff-ms=120000 --retry-backoff-factor=1 now waits 120 s on every retry. On master the base was used for the first retry, but a factor > 0 capped later retries at 60 s. With factor 0 nothing changes.
  • Docs: the --retry-backoff-factor help text and man page now say what happens. The README does not document the retry flags.

Test evidence

  • test_retry_backoff_with_mixed_failures (new). A fake RESP server answers SET memtier-N with -TRYAGAIN the first N % 5 times. Run: 40 keys, --pipeline=8 --rate-limiting=20, --max-retries=4 --retry-backoff-ms=20 --retry-backoff-factor=4. The test checks that every gap between resends of a key is within [expected - 3 ms, expected * 1.25 + 25 ms] of that key's own backoff. Requests that fail while a 1.28 s timer is pending also exercise the early re-arm.

  • test_retry_backoff_is_per_request (changed). Now -n200 instead of -n3, because -n3 fits in one batch. It asserts:

    • elapsed < 10 s;
    • errors 200, retries 1000;
    • every failed-keys row has retries=5;
    • average latency within [250, 500] ms, since 10+20+40+80+160 = 310 ms. This bound rules out a delay that is always 0, a factor that is ignored (50 ms) and an off-by-one exponent (155 or 620 ms).
  • test_requests_in_flight_have_room_to_retry (new). A fake server fails about 60% of attempts, deterministically (crc32 of key and attempt). The run is -n600 --pipeline=8 --max-retries=4, factor 2, base 10 ms. The test asserts that no failed-keys row has retries < 4, and that the logged keys are exactly the keys whose 5 attempts all failed.

  • test_small_max_retry_queue_keeps_pipeline_depth (new). A fake server holds its replies until 64 SETs are waiting (or 0.5 s), with --pipeline=64 --max-retry-queue=4, no errors. It asserts that 64 requests were in flight at once. Result: 53f0fcd fails 2/2; this branch passes.

  • tests/unit/retry_drain_test (new, make check). A real client and connection over a Unix socket:

    1. A first retry is queued, and its timer fires while the connection is still disconnected.
    2. A retry on its 3rd resend is queued (due in 20 s).
    3. The connection is opened.
    4. The test asserts that the first retry reaches the server within 500 ms, and the second does not.

    Result: it fails without the enqueue change ("overdue retry sent within 500 ms of connecting"); it passes 6/6 with it.

  • Sanitizer tolerance in the mixed test. TSAN CI cells failed on the same two gaps every time (memtier-19 resend 2, memtier-21 resend 1). I reproduced this locally with ./configure --enable-thread-sanitizer and setarch -R. The cause is not an ordering bug in this PR. A TSAN build stalls the worker for ~200 ms about 1 s into the run, and every send due in that window is late, including first sends (memtier-22's first send moved from 1050 to 1219 ms). The same stall shows up with --retry-on-error off: 192 ms on this branch's TSAN build, and 225 and 244 ms on an origin/master TSAN build. The normal build has no stall (largest gap between first sends 50 ms). So only when ASAN_OPTIONS/TSAN_OPTIONS/UBSAN_OPTIONS is set does the test widen the upper bound to expected*1.5 + 100 ms and allow 10% of gaps (8 of 80) beyond it. The lower bound stays strict, and non-sanitizer builds keep the strict window with no outliers. With the sanitizer window, 24c7bce still fails with 32-60 of 80 gaps off. Local TSAN results:

    • unloaded: 8/8 pass;
    • 3 at a time on 2 CPUs: 6/6 pass;
    • 9 at a time on 2 CPUs: 9/9 pass, where the overloaded runs had 5-6 stalled gaps;
    • full test_retry_on_error.py: 27/27 pass, no ThreadSanitizer reports.
  • tests/unit/retry_backoff_test (new, make check). Covers factor 0/1/0.5/2, base 0, underflow, the 60 s cap, overflow to inf (DBL_MAX, 4e9 resends) and bases above 60 s.

binary mixed failures per request (-n200) room to retry depth (--max-retry-queue < --pipeline)
this branch (63dbab2 and earlier heads) 18/18 pass 6/6 pass 8/8 pass 3/3 pass
53f0fcd pass pass pass 2/2 fail
b4ae5c4 (per-request backoff, old queue hold) pass pass 3/3 fail (52, 58, 98 given up with retries left) not run
first version 24c7bce 3/3 fail (64-65 of 80 gaps off) 3/3 pass not run not run
origin/master 8f5fa34 3/3 fail (72-74 of 80 gaps off) 3/3 fail (not done at 20 s) not run not run

The three tests also pass under load: 9 at a time, all pinned to 2 CPUs with taskset -c 0,1, over 2 rounds (18/18). The review's test lens reports 35/35 for the mixed test across normal, taskset and ASan builds.

Failed-keys rows logged with retries left, same fake server, -n600 --max-retries=4. 53 keys are expected to fail all 5 attempts:

--pipeline b4ae5c4 rows (retries < 4) this branch rows (retries < 4)
4 97 (52) 53 (0)
8 130 (90) 53 (0)
16 136 (91) 53 (0)

All runs took about 1 s, so holding new work did not cost throughput here.

Resend gaps in the mixed scenario, in ms (median, with min-max in brackets):

resend expected this branch 24c7bce
1 20 20 (19-21) 303 (1-1232)
2 80 81 (80-81) 320 (80-1280)
3 320 320 (319-321) 1280 (320-1280)
4 1280 1281 (1280-1281) 1280

Manual repro with the issue's flags on this branch:

  • -n3: 1.0 s, average latency 311 ms;
  • -n200: 2.0 s, average latency 313 ms;
  • --test-time=5: 6.0 s.

In each run, errors equal the request count and retries are 5x that. The ~1 s floor comes from the stats tick.

Drain cost: each drain walks the queue once, which is O(queue) per drain, and that queue is bounded by the cap. Measured with the worst case for it: every SET failing, --pipeline=1024 (cap 4096), --retry-backoff-ms=1, unlimited retries, 5 s on one CPU.

Other suites, all run on this branch (63dbab2 or an earlier head):

  • test_retry_on_error.py: 27/27 with --env oss and 27/27 with --env oss-cluster on 63dbab2; 27/27 on a TSAN build (ead0c7a); make check 9/9;
  • test_reconnections.py 13/13, test_test_time_stalled_server.py 4/4, test_cluster_slots_refresh_overlap.py 1/1, test_cluster_readonly_drop.py 3/3, test_cluster_redirect_stats.py 9/9;
  • test_cluster_failover_retry.py 3/3, test_cluster_ask_asking.py 2/2, test_cluster_failed_keys.py 7/7;
  • test_cli_validation_retry_backoff.py 6/6;
  • make check: 8/8.

Fixes #696

Affected versions

2.4.0 through 2.5.2 (latest) and master (code). The stall is confirmed only on master.

  • Introduced by 08cfc24 "feat(retry): --retry-on-error with bytes-snapshot resend + failed-keys log (feat(retry): --retry-on-error with bytes-snapshot resend + failed-keys log #381)". That commit added the per-connection multiply in enqueue_retry(), the reset that only runs on success, and the timer that drains the whole queue. The first tag containing it is 2.4.0.
  • Confirmed by running on master 3b3c2d7 (in the issue), and on 577e799 and 8f5fa34 (above).
  • On 2.5.2 the same commands end after about 1 s because queued retries were dropped at run end (behaviour since changed on master), so the growth can't be seen from outside there. The same code is present, though (derived from history: 2.4.0-2.5.2).

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🤖 Automated first-pass review. A human maintainer's review is still required before merge.

Thanks for this. I went through the diff and the description. The root cause analysis is convincing, and the fix (a due time per request, one timer armed for the earliest due time, and a drain that resends only what is due) looks right to me. Removing reset_retry_backoff() makes sense, since per-request state already gives the "recovered SUT goes back to fast retries" behaviour the old comment wanted. The fails-on-master / passes-on-branch table is the kind of evidence this repo has accepted before (PR#364 is a similar example). A few comments:

  1. --max-retry-queue semantics. You already list this as decision CentOS release 6.4 (Final) installation torture #2. Spelling out the user-visible side: anyone who set --max-retry-queue equal to or just above --pipeline used to keep a full pipeline until the queue itself filled. Now every queued retry takes one slot of pipeline depth. I think the trade is reasonable, because the old behaviour silently gave up on requests with retries left, which is worse. Still, it changes throughput under errors for an existing flag. Did you consider counting only in-flight requests against the cap's headroom when the user set the cap explicitly, and keeping the new rule for the auto cap? If that was ruled out, a sentence in the description saying why would help whoever signs off on this.

  2. Drain cost. handle_retry_drain_event() now rotates through the whole queue on every fire. With per-request due times it can fire about once per request, so a large --pipeline (auto cap pipeline*4) means O(n) per fire and roughly O(n²) per batch. That's probably fine at realistic sizes, and it only runs on the retry path, not the hot path. I may be wrong, but if the queue were kept ordered by due time (or split into one FIFO per resend count, since each FIFO is ordered by due time when the factor is fixed), the drain could stop at the first request that isn't due. Not blocking.

  3. Timing-based test windows. test_retry_backoff_with_mixed_failures uses expected*1.25 + 25 ms with no outliers allowed on non-sanitizer builds. After ci: run standalone test cells with PARALLELISM=2 and raise the step limit to 40 min #683 the standalone cells run with PARALLELISM=2, and the macOS runners are noisy. Have you run it on the full CI matrix more than once? Also, sanitizers are detected only through ASAN_OPTIONS/TSAN_OPTIONS/UBSAN_OPTIONS. A coverage (gcov) build or a slow runner that sets none of these gets the strict window. I'd lean toward allowing a small outlier budget everywhere and keeping the lower bound strict, since "never early" is the real invariant.

  4. Nitpicking: the man page and usage() now say "at most 60 s or retry-backoff-ms if larger". That's accurate, but it's a behaviour change for --retry-backoff-ms above 60 s with a factor > 0, and so far it is only in the PR description. Maybe add a line to the changelog/release notes when this ships.

The core fix looks solid. I'd mainly like an answer on the --max-retry-queue compat question, and some confidence that the strict timing test won't flake in CI, before this merges.

(I'd leave this as a plain comment, not a formal request for changes.)

@fcostaoliveira
fcostaoliveira force-pushed the fix-696-retry-backoff-per-request branch 2 times, most recently from c7a181d to b4ae5c4 Compare October 16, 2026 11:14
@fcostaoliveira fcostaoliveira changed the title Compute --retry-backoff-factor backoff per request Give each --retry-on-error retry its own backoff Oct 16, 2026
@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

Thanks. You were right about the design question, and the premise needs one correction: the first version (24c7bce) did make requests wait longer than their own backoff, not only shorter. The drain timer was armed with the delay of whichever request found it idle, and then resent the whole queue. So a first retry could ride a timer armed by a request on its 3rd-5th retry, and the reverse happened too. Reviewers measured this on 24c7bce:

  • fake server, 50% -TRYAGAIN, factor 4, base 10 ms: median first-retry gap 640 ms instead of 10 ms;
  • 60% -LOADING, factor 2: 620 of 804 retry gaps more than 1.5x the request's own backoff.

My -n3 test missed it because uniform failure keeps every retry in lockstep.

Point by point, on b4ae5c4:

  1. Design (pipelined / mixed retry counts). I didn't go for "largest backoff wins" or "factor only fully applies at --pipeline=1". Each queued retry now has its own due time, now + retry-backoff-ms * factor^resends. The connection keeps one timer, armed for the earliest due time. It is brought forward when a request with an earlier due time is queued, so a request at the 60 s cap no longer holds the others. When it fires it resends only the requests that are due, keeps the rest in order, and re-arms for the next one. So the factor applies per request, as the help text says, at any --pipeline. The help text and man page now spell out the formula and the cap.

  2. Pipelined test variant. I added test_retry_backoff_with_mixed_failures. A fake RESP server fails SET memtier-N N % 5 times, run with --pipeline=8 --rate-limiting=20, factor 4, base 20 ms. It asserts that every resend gap for each key matches that key's own backoff. Results:

    • 24c7bce: 3/3 fail (64-65 of 80 gaps off; median first-retry gap 303 ms, max 1232 ms, expected 20 ms);
    • origin/master: 3/3 fail;
    • this branch: 18/18 pass, with gaps of 20/81/320/1281 ms against 20/80/320/1280 expected.

    test_retry_backoff_is_per_request now uses -n200 and checks that average latency is within [250, 500] ms, because -n3 fits in a single batch. A new make check unit test covers the delay function (cap, overflow, factor 0/1/<1, base 0).

  3. Comment nit. I removed the member function and its header comment. The new retry_backoff_delay_ms(base_ms, factor, resends) documents "already resent resends times", and the queue comment in shard_connection.h describes the per-request due times.

@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

Thanks. Taking your updated points in order, on 53f0fcd (rebased on master b1c46f4):

  1. Description. I rewrote it to match the code: due times per request, a drain that resends only the requests that are due, base above 60 s used as is, the -n200 test with latency bounds, and the new queue-cap change below.

  2. Wall clock vs monotonic. Agreed. This is new exposure, since the old code passed only relative delays to the timer. m_retry_due and m_retry_timer_due now come from clock_gettime(CLOCK_MONOTONIC), following the pattern in cluster_client.cpp. A wall-clock step can no longer hold queued retries back or release them early. The 1 ms slack in the drain only saves a timer wakeup for a request that falls due right after the timer fires. The comment now says so.

  3. fill_pipeline() interaction. That matches my reading. One related change landed here: review found that fill_pipeline() kept sending new requests until the retry queue was exactly full. Requests in flight that then failed found it full and were given up on with retries=0, even with --max-retries=4. Per-request backoffs made that about 10x more frequent: 90 of 130 failed-keys rows at --pipeline=8 on b4ae5c4. New work is now held while queued retries plus requests in flight reach the cap, so a request that fails in flight always has room. The new test is test_requests_in_flight_have_room_to_retry: 3/3 fail on b4ae5c4, 8/8 pass here. --pipeline semantics are unchanged, and the --max-retry-queue help text now describes this.

  4. Base above 60 s. Yes, that is intended. It is the first decision listed at the top of the description, so a maintainer can push back.

  5. Flakes under load. I ran the three new tests 9 at a time, all pinned to 2 CPUs (taskset -c 0,1), over 2 rounds: 18/18 passed. The review's test lens separately reports 35/35 for the mixed test across normal, taskset and ASan builds. On a quiet machine the measured gaps are within about 1 ms of expected (20/81/320/1281 ms against 20/80/320/1280), so the expected*1.25 + 25 ms tolerance leaves about 25 ms of headroom on the 20 ms gaps. The latency check also has room: the average is about 313 ms against a [250, 500] ms window.

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 53f0fcd. Configure here.

Comment thread shard_connection.cpp Resolved
@fcostaoliveira
fcostaoliveira force-pushed the fix-696-retry-backoff-per-request branch from 53f0fcd to ead0c7a Compare October 16, 2026 12:34
The retry backoff was a single value per connection: enqueue_retry()
multiplied it by --retry-backoff-factor on every queued retry, of any
request, and it was reset only when a retried request later succeeded.
A request that gave up after --max-retries left it where it was, so the
next request started from there, and requests in flight on the same
connection compounded each other's delay. With every SET failing,
-n1/-n2/-n3 with --max-retries=5 --retry-backoff-ms=10
--retry-backoff-factor=2 took 1 s / 4 s / 47 s, and a --test-time=8 run
was still running at 100 s.

The connection's single drain timer also resent the whole retry queue
when it fired, at the delay of whichever request had armed it. So with
mixed outcomes a first retry could wait for a timer armed by a 4th
retry, and a 4th retry could ride a timer armed by a first one.

Each queued retry now gets its own due time on the monotonic clock,
now + retry-backoff-ms * factor^resends (retry_backoff_delay_ms() in
retry_backoff.h). The timer is armed for the earliest due time, brought
forward when a request with an earlier due time is queued, and when it
fires it resends only the requests that are due, in queue order, and
re-arms for the next one. The per-connection value and its reset on
success are removed. The accounting, the move to the replay queue on
disconnect and the --transaction refusal are unchanged. MOVED/ASK
redirects count as resends, so they get the same backoff.

Requests now wait for retries in the queue rather than in flight, so
the queue fills more often, and fill_pipeline() sent new requests until
it was exactly full: requests in flight that then failed found it full
and were given up on with retries=0. fill_pipeline() now holds new work
while queued retries plus requests in flight reach the queue cap, so a
request that fails in flight always has room. --pipeline still counts
only requests in flight. The hold starts at --pipeline at the least, so
a smaller --max-retry-queue does not cut the pipeline on a healthy
server; the queue itself stays capped at --max-retry-queue.

When the drain timer fires while the connection cannot send, the due
requests stay queued and the timer goes idle. A retry queued after that
now keeps the timer at their due time rather than arming it for its own,
later one, so they go out as soon as the connection is set up.

The factor's growth stops at 60 s, as before, but a --retry-backoff-ms
above 60 s is now used as is with any factor: before, a factor > 0
capped it from the second retry on.

Fixes #696

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fcostaoliveira
fcostaoliveira force-pushed the fix-696-retry-backoff-per-request branch from ead0c7a to 63dbab2 Compare October 16, 2026 13:20
@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

Thanks. Point by point, on 63dbab2 (rebased on master 0370514):

  1. --max-retry-queue semantics. I took your less disruptive option. retry_queue_full() uses the user's value again as the hard queue limit, and only the hold in retry_queue_holds_new_work() uses max(cap, --pipeline).

    • Healthy run, --pipeline=64 --max-retry-queue=4: 455-457k ops/sec here versus 451-499k on master (53f0fcd made 94-113k). test_small_max_retry_queue_keeps_pipeline_depth still passes.
    • Trade-off: the guarantee that a request failing in flight always finds room now holds only with --max-retry-queue >= --pipeline, which includes the auto cap max(pipeline*4, 64). With an explicit smaller cap, requests in flight beyond it can be given up early, as on master. With every SET failing, --pipeline=64 --max-retry-queue=4 --max-retries=3 -n640 gives up 632 of 640 at retries=0; with --max-retry-queue=64 it gives up none early. The help text and man page say this.
  2. Description. Updated: the cap semantics above, the depth test and the new drain unit test in the results table, the TSAN stall section, and the Cursor fix.

  3. Base above 60 s. Yes, that's intended, and it is listed as decision 1 at the top of the description so a maintainer can push back.

  4. O(cap²) drain. Each drain walks the queue once, and the queue is bounded by the cap, so I measured the worst case. Setup: every SET failing, --pipeline=1024 (cap 4096), --retry-backoff-ms=1, unlimited retries, 5 s pinned to one CPU.

    The scan doesn't show up next to the network round trips, so I left it as is.

  5. Strict gap bounds outside sanitizers. CI is green across the full matrix on ead0c7a. Locally the strict window passed 18/18 with 9 runs at a time pinned to 2 CPUs. Sanitizer builds, where a ~200 ms TSAN-only worker stall at t≈1 s also shows up on master, get the wider window described in the PR.

Separately, a Cursor finding (overdue retries delayed by a later enqueue after a blocked drain) is fixed in the same push, with a unit test. That reply is inline.

@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

Re the automated review posted at 13:22:09, which crossed with my 13:22:18 reply. The reply covers points 1, 2 and 4. On the rest:

  • Point 1, an explicit --max-retry-queue: as of 63dbab2, an explicit cap is again the user's hard queue limit (retry_queue_full()). Only the new hold uses max(cap, --pipeline), so an explicit cap no longer reduces pipeline depth on a healthy run. With --pipeline=64 --max-retry-queue=4: 455-457k ops/sec, against 451-499k on master. The cost is that with an explicit cap below --pipeline, requests in flight beyond it can still be given up early, exactly as on master. The help text, man page and description say so.
  • Point 3, timing windows: the strict window has now passed the full CI matrix twice (ead0c7a and 63dbab2), plus 18/18 locally with 9 parallel runs pinned to 2 CPUs. The lower bound ("never early") is strict everywhere. If a non-sanitizer cell ever flakes, the fallback is the small outlier budget you suggest, and that is a one-line change to the test.
  • Point 4, release notes: agreed. The --retry-backoff-ms above 60 s change is decision 1 at the top of the description, which is where release notes get collected from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant