Repository navigation
Treat ordinary workload errors as connection progress - #788
Conversation
|
🤖 Automated first-pass review — a human maintainer's review is still required before merge. Thanks for this. I went through the
The fix itself looks right to me. I'd mainly want the unlimited-retry question answered before this merges, since it changes what an existing flag combination does by default. A second look from whoever owns the connection-stage supervisor would also help. (would file this as a comment, not a formal block) |
|
The max-clients/protected-mode concern was valid. Redis’s networking implementation sends those errors on accept and closes; the cluster max-clients variant has different wording too. Commit An actual private Redis Ordinary LOADING/MASTERDOWN/CLUSTERDOWN responses do count as command rejections, with unchanged logical request/error/retry accounting. The README/help/man note that unlimited retries with --requests can continue indefinitely; this is not a new retry policy. Timing guards leave a seven-second margin above the one-second startup deadline and every child has a 20-second outer bound. We retain the narrow rejection classification rather than delaying all workload progress until a later socket event, which would alter normal error-only workloads and still could not guarantee the server remains connected. |
|
Counting only final replies would preserve the same misclassification for a healthy connection that is serving retriable command rejections. It would also leave the outcome dependent on whether one earlier request happened to succeed: one OK already disarms the run-wide supervisor, after which the same unlimited retry workload has no setup-time bound. The supervisor is for establishing a working connection, not an implicit per-request retry deadline. A parsed ordinary error proves that progress, while logical completion still occurs only on success or exhaustion. The delayed-recovery test demonstrates that distinction: replies continue beyond setup timeout, then exactly four logical requests complete when the peer accepts them. The default -1 retry policy and its request-count consequences belong to #734; changing that policy/default or adding a retry deadline needs its own decision. This fix removes the accidental startup deadline and documents the consequence explicitly, with finite --max-retries or --test-time as the existing bounded controls. It does not claim an all-error workload is successful at the command level: failed-key rows, errors and logical totals remain accounted. The rejection prefixes intentionally follow the known Redis networking implementation, not an exhaustive promise about future versions or forks. Broadly excluding every DENIED/ERR status would recreate the ordinary-command problem; inferring rejection from a later close cannot reliably undo the run-wide steady-state latch once other callbacks/connections have progressed. The known Redis protocol, max-clients and protected-mode paths have explicit controls, including real maxclients behavior. Different server wording would need its own verified classifier/control. Ordinary workload errors remain logged and counted; they intentionally stop being attributed to setup. The PR body has been updated to include all three rejection categories and completed measurements. Eight-second failure guards leave seven seconds above the one-second setup deadline, with a 20-second subprocess safety bound; successful duration checks use the configured three-second lower bound, not an upper throughput/timing expectation. |
Problem
An error-only workload is aborted as a connection-stage failure even when setup succeeds and the server continuously answers requests. Ordinary ERR, READONLY, NOPERM and OOM replies never mark steady state. They also fail to reset the reconnect-attempt budget after a recovered connection serves work.
Root cause
The workload-response branch accepts only non-error replies as connection progress. That rule was introduced to keep Redis wire-protocol rejection/reconnect loops bounded, but also catches legitimate command rejections.
Fix
Count ordinary parsed workload replies as connection progress, including errors claimed for retry, and reset the connection’s reconnect budget. Preserve Redis protocol-error, max-clients (including the cluster variant), and protected-mode rejection prefixes: Redis closes after these failures, so they must not disable the startup supervisor or reset the reconnect budget. Their no-AUTH greetings can be mistaken for the first pipelined workload reply. Setup-command rejection and local parser-failure paths are unchanged.
Logical completion/error/retry accounting is unchanged. In particular, unlimited request-count retries can continue indefinitely against permanent rejection; help, man page and README now explicitly recommend finite retries or a timed workload. This does not change the retry policy discussed in #734.
Tests
cae16bf6; the added accept-time test also fails against the initial implementation before the corresponding guards.maxclients=1: initial implementation incorrectly resets the reconnect budget and exits 0; final implementation rejects exactly two connections, never resets the budget, and exits 1 with--max-reconnect-attempts=1.make formatandmake format-checkpass.Affected versions
2.4.0 through 2.5.2 and master. Introduced by
2e8869effe8f14f61c083b410d66b90ae06d0f4e(#431); release applicability is verified from source history. The issue records a 2.5.2 runtime reproduction, and this PR independently reproduces on its current master base. The reconnect-reset placement arrived withee757e71(#456).Fixes #686
🤖 Generated with Claude Code
Note
Medium Risk
Changes when connections are considered steady-state and how reconnect limits reset in
shard_connection::process_response, which affects benchmark abort/timeout behavior under error-heavy workloads.Overview
Ordinary workload error replies (e.g.
-ERR,-OOM,-READONLY) now count as connection progress after setup: they mark steady state, disarm the startup supervisor, and reset the per-connection reconnect-attempt budget. Previously only successful replies did, so error-only workloads could hit--connection-stage-timeoutand never recover reconnect limits.Redis accept-time / wire rejections stay startup failures via
is_redis_connection_rejection()(-ERR Protocol error:, max-clients, protected-mode-DENIED). Those still report connection-stage failure and do not reset reconnect budgets.Docs (README, man page,
--help) now warn that with--requestsand unlimited--max-retries, perpetual command rejections can run indefinitely because workload errors are progress and--connection-stage-timeoutdoes not cap retries.Adds
tests/test_workload_error_progress.pycovering steady-state on ordinary errors, protocol vs setup failures, reconnect budget reset, retry accounting, and run-count reset behavior.Reviewed by Cursor Bugbot for commit cff19c5. Bugbot is set up for automated code reviews on this repo. Configure here.