Skip to content

Reconnect when AUTH/SELECT/HELLO fails on a reconnect instead of hanging - #630

Merged
fcostaoliveira merged 5 commits into
masterfrom
fix/auth-fail-reconnect-625
Oct 14, 2026
Merged

fcostaoliveira merged 5 commits into
masterfrom
fix/auth-fail-reconnect-625

Conversation

@fcostaoliveira

@fcostaoliveira fcostaoliveira commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

With --reconnect-on-error, if the server's password changes mid-run and the connections are then dropped, memtier reconnects, logs Reconnection successful after 1 attempts., gets -WRONGPASS for AUTH, and then hangs until it is killed. --test-time, --requests and --max-reconnect-attempts are all ignored (#625).

Root cause

  • In shard_connection::process_response(), an AUTH, SELECT or HELLO error reply only sets error = true, and the function then returns. The connection stays open with its setup unfinished, so no workload request is sent on it again. The --test-time/--requests checks run only when requests are sent or answered, so they are never reached.
  • --connection-stage-timeout stops checking once the run has reached steady state. On master it is the only reason a wrong password at startup ends (exit 2).
  • handle_reconnect_timer_event() logged "Reconnection successful" as soon as the TCP connect started, before the setup ladder ran.

Fix

  • With --reconnect-on-error, an AUTH/SELECT/HELLO error now goes through attempt_reconnect(), as READONLY errors already do. That disconnects and schedules the next attempt with the usual backoff, so --max-reconnect-attempts bounds it, and when the attempts run out the thread ends and the run fails. Startup with a wrong password:
    • Without --reconnect-on-error, nothing changes: it ends through --connection-stage-timeout with exit 2.
    • With --reconnect-on-error and unlimited attempts, it also still ends that way, with exit 2.
    • With --reconnect-on-error and a finite --max-reconnect-attempts=N, it now ends after N attempts with Maximum reconnection attempts (N) exceeded for AUTH error and exit 1, if the attempts run out before the stage timeout. That is what a connection-refused startup already does under the same flags.
  • With unlimited attempts, a reconnect that follows a setup rejection and fires after the run is over (the run has started and finished() is true) is not made. This holds even when requests are held for replay. Since Resend requests after the setup ladder on a new connection #613, --retry-on-error keeps in-flight requests in the replay queue until setup succeeds, and here it never does. If no reply is pending, disconnect_all() ends the client and counts the held requests as run-ended-before-resend errors (Count retries still queued when a --test-time run ends (#619) #620). The log says Connection setup failed and the run is over, not reconnecting., and the run ends as incomplete (exit 1) instead of retrying forever. Plain connection drops near the deadline still reconnect and end as before. An earlier version of this PR stopped those too, and the sanitizer jobs caught it (test_json_aggregated_connection_errors_sec, test_F17_monotonicity_under_churn); the second commit fixes that.
  • "Reconnection successful after N attempts." is now logged on the first successful response after the setup ladder, at the point where m_reconnect_attempts is already reset. The timer path now logs only a debug line.

Tests

There are three new tests in tests/test_reconnections.py (standalone; they skip on cluster). Each sets requirepass, runs memtier with --authenticate, then changes the password and runs CLIENT KILL TYPE normal. The tests restore requirepass "" in a finally.

  • test_auth_failure_on_reconnect_honors_max_reconnect_attempts uses --max-reconnect-attempts=3 and --test-time=30. It asserts a nonzero exit within 15 s, the "Maximum reconnection attempts (3) exceeded" message, and no "Reconnection successful".
  • test_auth_failure_on_reconnect_honors_test_time uses unlimited attempts and --test-time=8. It asserts a nonzero exit within test_time + 5 s.
  • test_auth_failure_on_reconnect_with_retry_on_error_honors_test_time is the same with --retry-on-error --pipeline=16 and no rate limit, so requests are held for replay. On master 641aef2 plus this PR's first three commits it hung (killed at 25 s). With the fourth commit it exits 1 after 10 s and logs 16 request(s) held for retry when the run ended were not resent; counted as errors.

Results, measured locally with RLTest --env existing-env (standalone redis):

binary max-attempts test test-time test
origin/master 013cb85 FAIL: hung, killed at 47 s FAIL: hung, killed at 25 s
this PR PASS 11/11 (exit 1, 5.0 s) PASS 11/11 (exit 1, 9–10 s)
  • With the fix, test_reconnections.py passes, apart from test_reconnect_on_connection_kill. Against a local existing-env server that test's run finishes in 0.14 s, before its first kill, and its failure helper then raises AttributeError: dbDirPath. That is environmental, and it passes in CI. After the rebase onto 641aef2, the three new tests pass, test_retry_on_error.py passes 16/16, and test_json_aggregated_connection_errors_sec and test_F17_monotonicity_under_churn pass 4/4 each.
  • tests_oss_simple_flow.py fails the same 9 tests with and without the fix when run against a reused existing-env server. Those failures are leftover keyspace counts from that setup, not this change.
  • CI covers the full matrix.

Manual repro from the issue (--test-time 10, wrapped in timeout 40): master exits 124 after 40 s. With this PR it exits 1 after 12 s with error: [RUN #1] 1 of 1 thread(s) ended before the requested test time was reached.

Relation to #613

#613 is merged. This PR is rebased on master 641aef2, and its fourth commit covers the replay-held case that #613 makes reachable.

Fixes #625

Affected versions

2.3.0 through 2.5.2 (latest) and master. The bug was introduced by 7ae9f65 ("Connection Error Tracking & Auto-Reconnect", #320), which added the mid-run reconnect that re-runs the setup ladder without handling a failure in it. The repro was confirmed by running on master (013cb85) and on 2.5.2. 2.3.0–2.5.1 are derived from history (git tag --contains 7ae9f65). Details are in #625.

Other user-visible log changes (from review)

🤖 Generated with Claude Code


Note

Medium Risk
Changes mid-run reconnection and teardown when setup fails; affects --reconnect-on-error, --max-reconnect-attempts, and --test-time completion paths but is covered by new integration tests.

Overview
Fixes a hang when --reconnect-on-error reconnects but AUTH, SELECT, or HELLO fails during the setup ladder (e.g. password changed mid-run): those errors now go through reconnect_after_setup_error → attempt_reconnect, so --max-reconnect-attempts and normal backoff apply instead of leaving the socket open with setup stuck forever.

Adds m_setup_rejected so that after the run has started and finished(), a pending reconnect timer does not retry forever on repeated setup failures (including with --retry-on-error replay held). "Reconnection successful after N attempts" is logged only after the setup ladder and the first successful workload response, not when TCP connect starts.

Three RLTest cases in test_reconnections.py change the password mid-run, kill clients, and assert bounded exit time, max attempts, and no false success logs.

Reviewed by Cursor Bugbot for commit 35030a0. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Oct 14, 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 surrounding process_response() / attempt_reconnect() code. Sending AUTH/SELECT/HELLO errors through the same path READONLY already uses seems like the right shape to me. It's the "all errors through the same path" direction suggested back in #320, the PR that introduced this bug. The new tests also pin the hang directly. A few questions:

  • handle_reconnect_timer_event(): when all_connections_idle() is false, we log "not reconnecting" and return, but don't call disconnect_all(). Who ends the client in that case? In standalone with one connection per client I think this can't happen. In cluster, though, a sibling shard connection could still have replies pending. Does the normal completion path then reach disconnect_all() and count the held replays, or can the client sit unended until the thread is torn down? I may be missing where that happens.

  • Just checking a side effect at startup. With --reconnect-on-error, unlimited attempts and a wrong password from the start, we used to keep one connection open and quietly wait for --connection-stage-timeout. Now we cycle disconnect/reconnect with backoff until it fires. Each cycle goes through update_connection_error(), so the connection-error stats in the JSON output now count AUTH rejections that weren't counted before. Exit code 2 stays the same, as you note. I think this is defensible, since it's the same thing connection-refused already does. Still, it changes what that counter means for this case, so it may be worth a sentence in the description.

  • m_setup_rejected = m_reconnecting; depends on attempt_reconnect() leaving m_reconnecting set only when it actually scheduled a timer. That's true today. Would it be clearer if attempt_reconnect() returned whether it scheduled one, so the flag doesn't depend on that internal detail?

  • Nitpicking: "Reconnection successful" moves from the timer path to the first successful response, and the old debug line is promoted to error level. That's the right fix for the false-positive log. The existing tests that count it (e.g. test_retry_on_error.py asserting exactly clients occurrences) still hold, since m_reconnect_attempts is reset right after. I'm only mentioning it because the timing of a log line that people grep for has changed.

The core fix looks solid to me. I'd mainly like the all_connections_idle()-false path answered before this merges.

(would file this as a comment, not a formal block)

@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

Thanks. Point by point:

  1. Startup with --reconnect-on-error and a finite --max-reconnect-attempts. You're right that this changes. With -a wrong --reconnect-on-error --max-reconnect-attempts 2, the run now ends after about 3 s with Maximum reconnection attempts (2) exceeded for AUTH error, ending this thread. and the usual "thread(s) ended before the requested test time" error, exit 1. It used to end through --connection-stage-timeout with exit 2. I think the new behaviour is correct: it is exactly what a connection-refused startup already does under the same flags (checked: Maximum reconnection attempts (2) exceeded for Connection error, exit 1, about 3 s), and the user asked for that bound. Both are still nonzero, and the stage supervisor still wins when the attempts outlast it. Without --reconnect-on-error, nothing changes: the AUTH arm doesn't reconnect, so a wrong password still exits 2 through --connection-stage-timeout. With --reconnect-on-error and unlimited attempts, it also still exits 2 (checked with --connection-stage-timeout 5: exit 2 after 5 s, same as master). I've described the change in the PR body rather than pinning the exit code in a test, because which path ends the run depends on backoff versus stage-timeout timing.

  2. Early return in handle_reconnect_timer_event() in cluster mode. Good catch, and CI agreed with you on the broader version. The first commit skipped any reconnect after the deadline, which broke plain drops near the end of a run (test_json_aggregated_connection_errors_sec, test_F17_monotonicity_under_churn in the sanitizer jobs). 70c52c0 narrows it to a reconnect that follows an AUTH/SELECT/HELLO rejection on this connection (m_setup_rejected, cleared on connect()/disconnect() and when the timer fires). It still requires that the run has started, finished() is true and this connection's replay queue is empty. In cluster mode, requests adopted from another connection land in this connection's m_replay_queue and keep it reconnecting. A pending slot-map refresh is not affected: that path returns ret > 0 from reconnect() and never gets here unless a setup step was rejected. Cluster drops and MOVED-driven reconnects behave exactly as on master.

  3. Fixed time.sleep(2) in the tests. The wait has slack: the run is rate-limited (--rate-limiting=200) and the kill asserts killed >= 2, so a slow runner that has not connected yet fails loudly instead of passing vacuously. The assertions also don't depend on how many requests were answered before the kill, only on the run ending after it. Locally the tests pass 11/11 (5.0 s and 9–10 s). If CI shows flakiness, I'll switch to polling CLIENT LIST the way _run_with_mid_run_client_kill does.

🤖 Generated with Claude Code

fcostaoliveira and others added 4 commits October 14, 2026 11:16
With --reconnect-on-error, if the server's password changes mid-run and the
connections are then dropped, memtier reconnects, logs "Reconnection
successful", gets -WRONGPASS for AUTH, and hangs until killed. --test-time,
--requests and --max-reconnect-attempts are all ignored.

An AUTH, SELECT or HELLO error reply only set error and returned from
process_response(). The connection stayed open with its setup unfinished,
so no workload request was ever sent on it again, and the --test-time and
--requests checks, which run when requests are sent or answered, were never
reached. --connection-stage-timeout does not help either: it stops checking
once the run has reached steady state. A wrong password at startup only
ends because of it.

With --reconnect-on-error, handle a setup error like a dropped connection,
as READONLY errors already are: attempt_reconnect() disconnects and
schedules the next attempt, so --max-reconnect-attempts bounds it.
Without the option, startup is unchanged.

With unlimited attempts, the reconnect timer now leaves the connection
disconnected once the run is finished (and nothing is held for replay), so
the thread ends at --test-time and the run fails as incomplete instead of
reconnecting forever.

"Reconnection successful" was logged when the TCP connect was started,
before the setup ladder ran. Log it on the first successful response after
the setup ladder, where the attempt counter is already reset.

Fixes #625

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The previous commit left any connection disconnected when its reconnect
timer fired after the run's deadline. A plain connection drop near the end
of a --test-time run then left that client without an end time, and the run
failed as incomplete (test_json_aggregated_connection_errors_sec and
test_F17_monotonicity_under_churn in the sanitizer jobs). Before, the
reconnect went through and the client ended on its first response.

Only stop when the pending reconnect follows an AUTH/SELECT/HELLO rejection,
which is the case that otherwise retries forever with unlimited attempts.
The run then fails as incomplete, with a message saying why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Under TLS, add_required_env_arguments() opens new connections to the
server to set tls-protocols. The AUTH tests set requirepass before it, so
those connections failed with "Authentication required", outside the
try/finally that clears the password, and every later test on the server
failed the same way.

Set requirepass right before memtier starts, inside the try. Clear it
through a connection authenticated with the new password if the pool has
to open one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With --retry-on-error, the requests in flight when the connection drops
are held for replay until the setup ladder succeeds (#613). After a
rejected AUTH that never happens, but the deadline check in
handle_reconnect_timer_event() required an empty replay queue, so the run
still reconnected forever (#625).

Give up once the run is over regardless of held replays. If no reply is
pending, disconnect_all() ends the client and counts the held requests as
run-ended-before-resend errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fcostaoliveira
fcostaoliveira force-pushed the fix/auth-fail-reconnect-625 branch from cdcfb2c to 4a00179 Compare October 14, 2026 10:21
Without this, the test passed even if the timer path dropped the requests
held for replay instead of handing them to disconnect_all().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

Follow-up on point 2 of my earlier reply, now that the PR is rebased on master with #613. The replay-queue exception I described there is gone.

Since #613, --retry-on-error holds in-flight requests until setup succeeds. After a rejected AUTH it never does, so that exception kept the run reconnecting forever.

  • 4a00179 gives up once the run is over, even if requests are still held for replay.
  • If no reply is pending, disconnect_all() counts those requests as run-ended-before-resend errors.
  • test_auth_failure_on_reconnect_with_retry_on_error_honors_test_time covers this. As of 35030a0 it also asserts that those requests are counted. A mutant that drops the disconnect_all() call now fails it.

🤖 Generated with Claude Code

@fcostaoliveira
fcostaoliveira merged commit 3b3c2d7 into master Oct 14, 2026
127 checks passed
fcostaoliveira added a commit that referenced this pull request Oct 15, 2026
In --cluster-mode, a CLUSTER SLOTS reply that is empty (*0) or an error
only logged "cluster slot failed." and returned. m_cluster_slots stayed
setup_sent, so the connection never sent a workload request again and
set_cluster_slots() refused to queue another refresh; only a disconnect
would reset it, and nothing disconnected. On a mid-run refresh (after a
-MOVED) the run hung past --test-time and --requests, also with
--reconnect-on-error. At startup a node that briefly has no slots was
asked once, and the run ended at --connection-stage-timeout. The branch
also left set_keep_value(true) in place.

Treat the reply like a rejected setup step. Clear keep_value, then:
- with --reconnect-on-error, reconnect through
  reconnect_after_setup_error() as AUTH/SELECT/HELLO errors do (#630), so
  --max-reconnect-attempts bounds the retries and they stop once the run
  is over;
- otherwise resend CLUSTER SLOTS after one second. The failure is counted
  as a connection error, which also advances the run's clock (it only
  moves on replies otherwise), so the run still ends at --test-time. At
  startup --connection-stage-timeout still applies, with the same message.

Fixes #648

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 15, 2026
In --cluster-mode, a CLUSTER SLOTS reply that is empty (*0) or an error
only logged "cluster slot failed." and returned. m_cluster_slots stayed
setup_sent, so the connection never sent a workload request again and
set_cluster_slots() refused to queue another refresh; only a disconnect
would reset it, and nothing disconnected. On a mid-run refresh (after a
-MOVED) the run hung past --test-time and --requests, also with
--reconnect-on-error. At startup a node that briefly has no slots was
asked once, and the run ended at --connection-stage-timeout. The branch
also left set_keep_value(true) in place.

Treat the reply like a rejected setup step. Clear keep_value, then:
- with --reconnect-on-error, reconnect through
  reconnect_after_setup_error() as AUTH/SELECT/HELLO errors do (#630), so
  --max-reconnect-attempts bounds the retries and they stop once the run
  is over;
- otherwise resend CLUSTER SLOTS after one second. The failure is counted
  as a connection error, which also advances the run's clock (it only
  moves on replies otherwise), so the run still ends at --test-time. At
  startup --connection-stage-timeout still applies, with the same message.

Fixes #648

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 15, 2026
…rver

With --reconnect-on-error and the default unlimited
--max-reconnect-attempts, a server that goes away for good kept a
--test-time run reconnecting once a second forever: the report was never
printed and the run had to be killed. attempt_reconnect() and the retry
branch of handle_reconnect_timer_event() reschedule the reconnect without
checking whether the run is over, and --test-time / --requests are
otherwise only checked when requests are sent or answered, which never
happens again on a connection that cannot connect. The only finished()
check in that path (#630) covers a rejected AUTH/SELECT/HELLO, not a
failed connect.

When a reconnect attempt fails and the run is over, stop retrying and end
the client, as when the deadline passes with all connections up: the run
ends at --test-time with its report. The first reconnect after a drop
still goes ahead, so a connection dropped at the deadline by a live server
is retried as before (the case #630 had to keep working). A rejected setup
step is still left to the #630 check, which fails the run.

With --requests the run can only complete once the server is back, so it
keeps waiting with unlimited attempts, as documented. It now warns every 10
failed attempts that the server is still unreachable, so a dead server can
be told from slow progress. Document both in --help and the README.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
In --cluster-mode, a CLUSTER SLOTS reply that is empty (*0) or an error
only logged "cluster slot failed." and returned. m_cluster_slots stayed
setup_sent, so the connection never sent a workload request again and
set_cluster_slots() refused to queue another refresh; only a disconnect
would reset it, and nothing disconnected. On a mid-run refresh (after a
-MOVED) the run hung past --test-time and --requests, also with
--reconnect-on-error. At startup a node that briefly has no slots was
asked once, and the run ended at --connection-stage-timeout. The branch
also left set_keep_value(true) in place.

Treat the reply like a rejected setup step. Clear keep_value, then:
- with --reconnect-on-error, reconnect through
  reconnect_after_setup_error() as AUTH/SELECT/HELLO errors do (#630), so
  --max-reconnect-attempts bounds the retries and they stop once the run
  is over;
- otherwise resend CLUSTER SLOTS after one second. The failure is counted
  as a connection error, which also advances the run's clock (it only
  moves on replies otherwise), so the run still ends at --test-time. At
  startup --connection-stage-timeout still applies, with the same message.

Fixes #648

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
In --cluster-mode, a CLUSTER SLOTS reply that is empty (*0) or an error
only logged "cluster slot failed." and returned. m_cluster_slots stayed
setup_sent, so the connection never sent a workload request again and
set_cluster_slots() refused to queue another refresh; only a disconnect
would reset it, and nothing disconnected. On a mid-run refresh (after a
-MOVED) the run hung past --test-time and --requests, also with
--reconnect-on-error. At startup a node that briefly has no slots was
asked once, and the run ended at --connection-stage-timeout. The branch
also left set_keep_value(true) in place.

Treat the reply like a rejected setup step. Clear keep_value, then:
- with --reconnect-on-error, reconnect through
  reconnect_after_setup_error() as AUTH/SELECT/HELLO errors do (#630), so
  --max-reconnect-attempts bounds the retries and they stop once the run
  is over;
- otherwise resend CLUSTER SLOTS after one second. The failure is counted
  as a connection error, which also advances the run's clock (it only
  moves on replies otherwise), so the run still ends at --test-time. At
  startup --connection-stage-timeout still applies, with the same message.

Fixes #648

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and the default unlimited
--max-reconnect-attempts, a server that goes away for good kept a
--test-time run reconnecting once a second forever: the report was never
printed and the run had to be killed. attempt_reconnect() and the retry
branch of handle_reconnect_timer_event() reschedule the reconnect without
checking whether the run is over, and --test-time / --requests are
otherwise only checked when requests are sent or answered, which never
happens again on a connection that cannot connect. The only finished()
check in that path (#630) covers a rejected AUTH/SELECT/HELLO, not a
failed connect.

When a reconnect attempt fails and the run is over, stop retrying and end
the client, as when the deadline passes with all connections up: the run
ends at --test-time with its report. The first reconnect after a drop
still goes ahead, so a connection dropped at the deadline by a live server
is retried as before (the case #630 had to keep working). A rejected setup
step is still left to the #630 check, which fails the run.

With --requests the run can only complete once the server is back, so it
keeps waiting with unlimited attempts, as documented. It now warns every 10
failed attempts that the server is still unreachable, so a dead server can
be told from slow progress. Document both in --help and the README.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
In --cluster-mode, a CLUSTER SLOTS reply that is empty (*0) or an error
only logged "cluster slot failed." and returned. m_cluster_slots stayed
setup_sent, so the connection never sent a workload request again and
set_cluster_slots() refused to queue another refresh; only a disconnect
would reset it, and nothing disconnected. On a mid-run refresh (after a
-MOVED) the run hung past --test-time and --requests, also with
--reconnect-on-error. At startup a node that briefly has no slots was
asked once, and the run ended at --connection-stage-timeout. The branch
also left set_keep_value(true) in place.

Treat the reply like a rejected setup step. Clear keep_value, then:
- with --reconnect-on-error, reconnect through
  reconnect_after_setup_error() as AUTH/SELECT/HELLO errors do (#630), so
  --max-reconnect-attempts bounds the retries and they stop once the run
  is over;
- otherwise resend CLUSTER SLOTS after one second. The failure is counted
  as a connection error, which also advances the run's clock (it only
  moves on replies otherwise), so the run still ends at --test-time. At
  startup --connection-stage-timeout still applies, with the same message.

Fixes #648

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
In --cluster-mode, a CLUSTER SLOTS reply that is empty (*0) or an error
only logged "cluster slot failed." and returned. m_cluster_slots stayed
setup_sent, so the connection never sent a workload request again and
set_cluster_slots() refused to queue another refresh; only a disconnect
would reset it, and nothing disconnected. On a mid-run refresh (after a
-MOVED) the run hung past --test-time and --requests, also with
--reconnect-on-error. At startup a node that briefly has no slots was
asked once, and the run ended at --connection-stage-timeout. The branch
also left set_keep_value(true) in place.

Treat the reply like a rejected setup step. Clear keep_value, then:
- with --reconnect-on-error, reconnect through
  reconnect_after_setup_error() as AUTH/SELECT/HELLO errors do (#630), so
  --max-reconnect-attempts bounds the retries and they stop once the run
  is over;
- otherwise resend CLUSTER SLOTS after one second. The failure is counted
  as a connection error, which also advances the run's clock (it only
  moves on replies otherwise), so the run still ends at --test-time. At
  startup --connection-stage-timeout still applies, with the same message.

Fixes #648

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and the default unlimited
--max-reconnect-attempts, a server that goes away for good kept a
--test-time run reconnecting once a second forever: the report was never
printed and the run had to be killed. attempt_reconnect() and the retry
branch of handle_reconnect_timer_event() reschedule the reconnect without
checking whether the run is over, and --test-time / --requests are
otherwise only checked when requests are sent or answered, which never
happens again on a connection that cannot connect. The only finished()
check in that path (#630) covers a rejected AUTH/SELECT/HELLO, not a
failed connect.

When a reconnect attempt fails and the run is over, stop retrying and end
the client, as when the deadline passes with all connections up: the run
ends at --test-time with its report. The first reconnect after a drop
still goes ahead, so a connection dropped at the deadline by a live server
is retried as before (the case #630 had to keep working). A rejected setup
step is still left to the #630 check, which fails the run.

With --requests the run can only complete once the server is back, so it
keeps waiting with unlimited attempts, as documented. It now warns every 10
failed attempts that the server is still unreachable, so a dead server can
be told from slow progress. Document both in --help and the README.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
The deadline was only checked when a reconnect attempt failed. A reconnect
armed before the deadline still waited its full backoff delay (up to
MEMTIER_BACKOFF_CAP_SEC, 60 s), and the client's stats ended at that later
failure, so --test-time 4 with --reconnect-backoff-factor 20 ran for 22 s
and reported a 21.8 s duration and a fraction of the real throughput.

- Arm every reconnect no later than the deadline: the delay is capped at
  the time left, on a local copy, so the backoff schedule is unchanged.
- When a connect fails and the run is over, end a started client's stats
  at the deadline, so the duration and ops/sec reflect --test-time.
- Stop only on a failed connect, not on a drop of an established
  connection: a live server that closes connections around the deadline
  (e.g. a CLIENT KILL loop) still gets the requests held for replay
  resent. This replaces the m_reconnect_attempts == 0 "first reconnect"
  rule, which broke because the counter is reset only on a reply.
- Cover a client that never started (its connection was up but never
  answered while another client's was): once any connection reached
  steady state the connection-stage supervisor is disarmed, so time it
  from the benchmark's start, as PR #667's run_is_over() does. The #630
  check for a rejected setup uses the same helper.
- Leave a cluster connection whose dial fails after the run is over dead,
  instead of ending the client from inside the CLUSTER SLOTS handler.

The deadline wins over a finite --max-reconnect-attempts: a run whose
attempts are not exhausted by the deadline ends normally (exit 0); one
whose attempts run out first still fails (exit 1). README, --help and the
man page say so.

Refs #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and the default unlimited
--max-reconnect-attempts, a server that goes away for good kept a
--test-time run reconnecting once a second forever: the report was never
printed and the run had to be killed. attempt_reconnect() and the retry
branch of handle_reconnect_timer_event() reschedule the reconnect without
checking whether the run is over, and --test-time / --requests are
otherwise only checked when requests are sent or answered, which never
happens again on a connection that cannot connect. The only finished()
check in that path (#630) covers a rejected AUTH/SELECT/HELLO, not a
failed connect.

When a reconnect attempt fails and the run is over, stop retrying and end
the client, as when the deadline passes with all connections up: the run
ends at --test-time with its report. The first reconnect after a drop
still goes ahead, so a connection dropped at the deadline by a live server
is retried as before (the case #630 had to keep working). A rejected setup
step is still left to the #630 check, which fails the run.

With --requests the run can only complete once the server is back, so it
keeps waiting with unlimited attempts, as documented. It now warns every 10
failed attempts that the server is still unreachable, so a dead server can
be told from slow progress. Document both in --help and the README.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
The deadline was only checked when a reconnect attempt failed. A reconnect
armed before the deadline still waited its full backoff delay (up to
MEMTIER_BACKOFF_CAP_SEC, 60 s), and the client's stats ended at that later
failure, so --test-time 4 with --reconnect-backoff-factor 20 ran for 22 s
and reported a 21.8 s duration and a fraction of the real throughput.

- Arm every reconnect no later than the deadline: the delay is capped at
  the time left, on a local copy, so the backoff schedule is unchanged.
- When a connect fails and the run is over, end a started client's stats
  at the deadline, so the duration and ops/sec reflect --test-time.
- Stop only on a failed connect, not on a drop of an established
  connection: a live server that closes connections around the deadline
  (e.g. a CLIENT KILL loop) still gets the requests held for replay
  resent. This replaces the m_reconnect_attempts == 0 "first reconnect"
  rule, which broke because the counter is reset only on a reply.
- Cover a client that never started (its connection was up but never
  answered while another client's was): once any connection reached
  steady state the connection-stage supervisor is disarmed, so time it
  from the benchmark's start, as PR #667's run_is_over() does. The #630
  check for a rejected setup uses the same helper.
- Leave a cluster connection whose dial fails after the run is over dead,
  instead of ending the client from inside the CLUSTER SLOTS handler.

The deadline wins over a finite --max-reconnect-attempts: a run whose
attempts are not exhausted by the deadline ends normally (exit 0); one
whose attempts run out first still fails (exit 1). README, --help and the
man page say so.

Refs #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
In --cluster-mode, a CLUSTER SLOTS reply that is empty (*0) or an error
only logged "cluster slot failed." and returned. m_cluster_slots stayed
setup_sent, so the connection never sent a workload request again and
set_cluster_slots() refused to queue another refresh; only a disconnect
would reset it, and nothing disconnected. On a mid-run refresh (after a
-MOVED) the run hung past --test-time and --requests, also with
--reconnect-on-error. At startup a node that briefly has no slots was
asked once, and the run ended at --connection-stage-timeout. The branch
also left set_keep_value(true) in place.

Treat the reply like a rejected setup step. Clear keep_value, then:
- with --reconnect-on-error, reconnect through
  reconnect_after_setup_error() as AUTH/SELECT/HELLO errors do (#630), so
  --max-reconnect-attempts bounds the retries and they stop once the run
  is over;
- otherwise resend CLUSTER SLOTS after one second. The failure is counted
  as a connection error, which also advances the run's clock (it only
  moves on replies otherwise), so the run still ends at --test-time. At
  startup --connection-stage-timeout still applies, with the same message.

Fixes #648

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and the default unlimited
--max-reconnect-attempts, a server that goes away for good kept a
--test-time run reconnecting once a second forever: the report was never
printed and the run had to be killed. attempt_reconnect() and the retry
branch of handle_reconnect_timer_event() reschedule the reconnect without
checking whether the run is over, and --test-time / --requests are
otherwise only checked when requests are sent or answered, which never
happens again on a connection that cannot connect. The only finished()
check in that path (#630) covers a rejected AUTH/SELECT/HELLO, not a
failed connect.

When a reconnect attempt fails and the run is over, stop retrying and end
the client, as when the deadline passes with all connections up: the run
ends at --test-time with its report. The first reconnect after a drop
still goes ahead, so a connection dropped at the deadline by a live server
is retried as before (the case #630 had to keep working). A rejected setup
step is still left to the #630 check, which fails the run.

With --requests the run can only complete once the server is back, so it
keeps waiting with unlimited attempts, as documented. It now warns every 10
failed attempts that the server is still unreachable, so a dead server can
be told from slow progress. Document both in --help and the README.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
The deadline was only checked when a reconnect attempt failed. A reconnect
armed before the deadline still waited its full backoff delay (up to
MEMTIER_BACKOFF_CAP_SEC, 60 s), and the client's stats ended at that later
failure, so --test-time 4 with --reconnect-backoff-factor 20 ran for 22 s
and reported a 21.8 s duration and a fraction of the real throughput.

- Arm every reconnect no later than the deadline: the delay is capped at
  the time left, on a local copy, so the backoff schedule is unchanged.
- When a connect fails and the run is over, end a started client's stats
  at the deadline, so the duration and ops/sec reflect --test-time.
- Stop only on a failed connect, not on a drop of an established
  connection: a live server that closes connections around the deadline
  (e.g. a CLIENT KILL loop) still gets the requests held for replay
  resent. This replaces the m_reconnect_attempts == 0 "first reconnect"
  rule, which broke because the counter is reset only on a reply.
- Cover a client that never started (its connection was up but never
  answered while another client's was): once any connection reached
  steady state the connection-stage supervisor is disarmed, so time it
  from the benchmark's start, as PR #667's run_is_over() does. The #630
  check for a rejected setup uses the same helper.
- Leave a cluster connection whose dial fails after the run is over dead,
  instead of ending the client from inside the CLUSTER SLOTS handler.

The deadline wins over a finite --max-reconnect-attempts: a run whose
attempts are not exhausted by the deadline ends normally (exit 0); one
whose attempts run out first still fails (exit 1). README, --help and the
man page say so.

Refs #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…of hanging (#667)

In cluster mode, a CLUSTER SLOTS reply that was empty (*0), an error, or
made only of malformed shards left the connection at setup_sent with no
timer and no disconnect, so the run hung forever (#648, #670).

- At startup (no reply yet), a failed CLUSTER SLOTS is retried every
  second until it succeeds, the run's deadline passes, or
  --connection-stage-timeout aborts the run; with --reconnect-on-error the
  connection reconnects instead. Startup retries are not charged to
  --test-time.
- A transient error is retried until the deadline. A client still without
  a slot map when the run is over fails the run instead of exiting 0,
  including under --clients-start, where the whole-second finished()
  check could otherwise mark it complete early.
- Mid-run, a bad CLUSTER SLOTS reply ends the thread (or reconnects with
  --reconnect-on-error). Under --requests, once another client is in
  steady state, the first failure ends the thread (unbounded waiting is
  tracked in #693).
- run_is_over() compares the full elapsed time; the #630 rejected
  AUTH/SELECT/HELLO check under --reconnect-on-error uses it too.
- Without --reconnect-on-error the thread-end message no longer names a
  reconnect limit that was never configured.

Covered by tests/test_cluster_slots_bad_reply.py.

Fixes #648
Fixes #670

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 16, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 17, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 17, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 17, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns every 10 attempts that the server is still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 17, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A client whose first connection completes only after the run is over
  is timed from the benchmark's start, so it ends at its first reply.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns once per process, after 10 failed attempts, that the server is
still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 17, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A client whose first connection completes only after the run is over
  is timed from the benchmark's start, so it ends at its first reply.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns once per process, after 10 failed attempts, that the server is
still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 17, 2026
…rver

With --reconnect-on-error and unlimited --max-reconnect-attempts (the
default), a server that goes away for good kept a --test-time run
reconnecting forever, with no report: the reconnect path never checked
whether the run was over, and finished() is otherwise only checked when
requests are sent or answered. A reconnect armed before the deadline also
waited out its full backoff (up to 60 s) and the report counted that dead
time.

With unlimited attempts:
- run_deadline() / run_is_over(): the stop condition in one place. A
  started client is timed from its own start, also on the wall clock
  (within 1 ms counts as passed); a client that never started, once any
  connection reached steady state, from the benchmark's start (#667's
  contract, which this extends).
- next_reconnect_delay() caps the armed delay at the time left, on a local
  copy, so the backoff schedule is unchanged.
- stop_reconnecting_if_run_over(): when a connect fails and the run is
  over, stop reconnecting; a started client's stats end at the deadline,
  so the duration and throughput reflect --test-time (exit 0).
- A setup rejected since the connection's last workload reply (any reply,
  errors included) still fails the run (#630), also when the server then
  goes away.
- A client whose first connection completes only after the run is over
  is timed from the benchmark's start, so it ends at its first reply.
- A drop of an established connection after the run is over gets one
  reconnect, so held replays are resent; a second drop counts as a failed
  connect (a peer that accepts and closes would otherwise loop at 0 s).
- The client is ended only once its other connections are done too
  (siblings_done()), e.g. another cluster shard with a reconnect pending;
  a failed run is recorded on the client (fail_run()) so a sibling's later
  normal end still fails it.

With a finite --max-reconnect-attempts nothing changes: the attempts bound
the run at their usual backoff, and running out of them fails it (exit 1),
as before.

Also: failed reconnects that never reach the event loop (unix socket), and
failed cluster dials after the run is over, are counted as connection
errors (count_connection_error()); with --requests and unlimited attempts,
memtier warns once per process, after 10 failed attempts, that the server is
still unreachable; a
cluster dial that fails after the run is over leaves the connection dead
instead of ending the client inside the CLUSTER SLOTS handler. README,
--help and the man page document the behaviour; tests in
test_reconnections.py and tests/unit/reconnect_siblings_test.cpp cover it.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 25, 2026
359d882 also stopped fill_pipeline()'s loop on the wall-clock deadline,
so a connection whose reconnect or slot map refresh came due at the
deadline, with nothing pending, sent no setup and ended its client
normally. Four tests in test_cluster_slots_bad_reply.py caught it:

- test_rejected_auth_once_at_deadline_fails_the_run (#666): the AUTH of
  the reconnect due at the deadline was never sent, so the rejected
  setup did not fail the run (#630) and it exited 0.
- test_cluster_slots_one_empty_reply_at_deadline_is_retried (#666): the
  slot map refresh due at the deadline was not sent (2 CLUSTER SLOTS
  requests instead of 3), so a one-off slot error was not retried.
- test_cluster_slots_{empty,malformed}_reply_mid_run_honours_test_time
  (#667): the refresh stopped at the deadline and the run ended
  normally, instead of failing as incomplete.

These are guarantees, not the old overcounting, and the tests are
unchanged. The loop condition is back to finished(), so setup still goes
out past the deadline; only the per-request break checks the deadline,
so no new workload does. The "done" check ends a client past its
deadline only once this connection's setup is done and its other
connections are done too (siblings_done(), not just no reply pending),
so a sibling's reconnect or refresh due at the deadline still runs.

This also restores cluster_slots_retention_test.cpp as it was: its slot
map retry past the deadline is a setup command and goes out again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 25, 2026
siblings_done() did not count a connection whose connect is in
progress: connect() clears the pending reconnect, and until the
connect completes the connection has no reply pending and nothing to
replay. A connection idle past its --test-time deadline, called again
by the --rate-limiting timer, then ended the client and closed the
sibling before it sent its setup, so a rejected AUTH on that redial no
longer failed the run (#630). Master waits for that connect, as the
idle connection had no reply to make finished() true.

Count a connection in progress as busy. Its connect completes or
fails (or hits --connection-timeout), and then the client ends as on
master.

Add a unit case for a sibling still connecting, and an RLTest case
where a cluster node's full accept queue holds the redial in progress
across the deadline. Both fail on the previous head.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 26, 2026
siblings_done() did not count a connected sibling whose setup still had
to go out with no reply pending. One case is the main connection once
a shard's reconnect timer has asked it for a CLUSTER SLOTS refresh,
before its deferred fill sends it. The reconnecting shard no longer
counts as pending by then. Another is a connection waiting for its
CLUSTER SLOTS retry timer. A connection idle past its --test-time
deadline could end the client in between, dropping the refresh and the
redial it leads to. A rejected setup on that redial then no longer
failed the run (#630).

Count such a sibling as busy, unless its refresh is held for an open
--transaction MULTI, which is not sent past the deadline (#569). The
refresh then goes out, and its reply, retry or error ends the client as
before. Add a unit case for a connected sibling with a refresh still to
send; it fails on the previous head. Align the deadline test's comment
with what siblings_done() checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 26, 2026
Once the run is over, end_client_after_run() leaves the client to a busy
sibling (siblings_done()), which since this PR includes a connect in
progress, so a redial's rejected AUTH still fails the run (#630). Without
--connection-timeout, a redial whose SYN is dropped (a firewalled or dead
node) then kept the run open for the kernel's connect timeout: with the
main connection's redial refused after the deadline, a 3 s run ended at
136 s, where master ended at 4 s.

end_client_after_run() now marks the client as waiting for its siblings,
and the drain grace ends such a client like one with replies pending, at
the deadline plus 10 s, with a "still waiting for a connection" warning.
A redial that connects within the grace keeps the #630 guarantee.
Single-endpoint clients have no siblings and are unchanged (#669's
idle-client guard).

Also widen the held-refresh transaction test's bound to test_time + 6.

Fixes #879
Fixes #880

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 26, 2026
ff07182 bounded the wait on a blackholed redial only when a connection
had tried to end the client after the run (end_client_after_run()). A
connection that stays up and idle past the deadline defers its end on
!siblings_done() in fill_pipeline() without marking the client, so the
drain grace still skipped it and the run waited for the kernel's connect
timeout (137 s for a 3 s run; 135 s on master). Without --rate-limiting
that connection is paused before the deadline and fill_pipeline() never
runs again, so marking the client from there cannot cover it.

The drain grace now also ends a client with a connection up and idle
(nothing it may send again) while another connection's connect is in
progress (client::idle_connection_waits_for_connect()). A sibling waiting
for its reconnect timer, or a client whose connections are all down, is
still left to the reconnect logic (#669). A redial that connects within
the grace still sends its AUTH (#630), and --connection-timeout, when
set, still ends the run sooner (5.0 s with 2).

Reported by Cursor Bugbot.

Fixes #879
Fixes #880

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 26, 2026
…thing past it (#892)

End every --test-time path at the deadline or last reply, and send nothing past it (#892)

With --test-time, no new workload request is sent past the deadline, and every end path (normal end, interrupt, drain grace, stalled-client end) ends at the deadline or the last reply, through one test_time_end() helper (#880). Setup and slot-map refreshes still go out past the deadline, so a reconnect's AUTH is never skipped (#630). A client past its deadline ends once its other connections are done and it holds no retries (shard_connection::may_send_again(), setup_step_sendable()). A sibling whose redial never connects is bounded by the 10 s drain grace, with a "still waiting for a connection" warning. A client whose first connection completes only after the deadline no longer counts toward Total duration/Count (#879).

Fixes #879
Fixes #880

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 26, 2026
-ERR Protocol error is caused by the request, e.g. a value above
proto-max-bulk-len, not by the connection. As the first reply on a new
connection it was handled as a rejected setup step, so a --test-time
--reconnect-on-error run whose oversized value happened to be first
after a reconnect failed at the deadline (#630), where master ended it
normally. Only a client that never got a reply still treats it as a
setup failure, so an all-oversized run still fails instead of ending
with exit 0 and Count 0. -ERR max number of clients and -DENIED keep
the setup handling before a connection's first reply.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira added a commit that referenced this pull request Oct 26, 2026
Don't count connection rejections as replies (#897)

A top-level `-ERR Protocol error`, `-ERR max number of clients` or `-DENIED` reply to a workload request is handled as a dropped connection (shard_connection::handle_connection_rejection()). It is not an op and cannot complete --requests or --test-time. The request is uncounted, or kept for replay under --retry-on-error.

- Without --reconnect-on-error the thread ends and the run fails with exit 1.
- Before a connection's first workload reply, max-clients and DENIED are setup rejections (reconnect_after_setup_error(), #630).
- `Protocol error` is caused by the request, so once the client has had any reply it is a plain drop. It is a setup failure only for a client that never got a reply.
- An optional replica closed for good now hands its held and queued requests to the slot primary through cluster_client::release_retired_connection(). That is the retire block moved unchanged out of handle_cluster_slots().

Fixes #894

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--reconnect-on-error: AUTH failure on reconnect (password changed mid-run) hangs forever, ignoring --test-time, after logging "Reconnection successful"

1 participant