Skip to content

Treat an unknown-command HELLO reply as RESP2 under --protocol=resp2 - #884

Merged
fcostaoliveira merged 3 commits into
masterfrom
fix/hello-unsupported-server
Oct 26, 2026
Merged

fcostaoliveira merged 3 commits into
masterfrom
fix/hello-unsupported-server

Conversation

@fcostaoliveira

@fcostaoliveira fcostaoliveira commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #488.

With --protocol=resp2, memtier sends HELLO 2 during connection setup and treats any error reply as fatal. A server without HELLO (Redis < 6.0, or another RESP server) answers -ERR unknown command 'HELLO', so the run sent no requests and --connection-stage-timeout ended it with exit 2. The default protocol sends no HELLO and is unaffected.

Fix (shard_connection.cpp):

  • --protocol=resp2: an unknown-command reply to HELLO counts as a successful HELLO step, since RESP2 is the wire default. One warning per process says the server does not support HELLO, so RESP2 was assumed.
  • --protocol=resp3: it stays fatal, with an added line: server does not support HELLO, so RESP3 is unavailable (Redis added HELLO in 6.0).
  • Other HELLO errors (-NOPROTO, auth errors) behave as before. No new flags.

Any -ERR unknown command reply to HELLO counts, whatever the quoting ('HELLO' in Redis 6+, backticks in 5.x, or none), since it answers memtier's own HELLO.

Tests: the scripted peer in tests/test_cluster_slots_bad_reply.py gets a hello_error option, and tests/test_connection_setup_rejected.py gets three tests:

  • RESP2: exit 0, all 800 requests answered, exactly one warning.
  • RESP3: non-zero exit with the new message.
  • -NOPROTO under RESP2 still fails.

With master's shard_connection.cpp the first two fail: the RESP2 run exits 2 with HELLO failed and 0 requests. Against a real Redis 5.0.14 (redis:5) with --protocol=resp2, master exits 2 and this PR runs normally, standalone and in cluster mode, with -a, --select-db and --pipeline=16. Results (ASan + UBSan, Ubuntu 24.04 container): make check passes, and both touched test files pass 37/37 standalone.

🤖 Generated with Claude Code


Note

Low Risk
Narrow change to connection-setup HELLO handling for explicit resp2/resp3; workload and auth paths unchanged aside from allowing older Redis to proceed.

Overview
Fixes #488: with --protocol=resp2, memtier no longer aborts connection setup when the server replies to HELLO with unknown command (Redis < 6.0 and other RESP servers without HELLO).

In shard_connection.cpp, a new is_unknown_hello_error() matcher (case-insensitive -ERR unknown command) changes rt_hello handling: under RESP2, that reply is treated as a successful setup step (wire-default RESP2), with one process-wide warning; under RESP3, setup still fails but logs that RESP3 needs HELLO (Redis 6.0+). Other HELLO failures (e.g. -NOPROTO) are unchanged.

Tests: the scripted peer gains hello_error, plus three cases in test_connection_setup_rejected.py (RESP2 succeeds, RESP3 fails clearly, non-unknown HELLO still fails).

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

fcostaoliveira and others added 3 commits October 25, 2026 11:31
With --protocol=resp2 memtier sends HELLO 2 during connection setup. A
server without HELLO (Redis before 6.0, or another RESP server) answers
"-ERR unknown command 'HELLO'", which was treated as a fatal setup
failure, so the run never sent a request and was ended by
--connection-stage-timeout. RESP2 is the wire default, so the
connection can simply go on: the unknown-command reply now completes
the HELLO step, with one warning per process. Under --protocol=resp3
the failure stays fatal, but now says that the server does not support
HELLO and RESP3 needs Redis 6.0 or later. Other HELLO errors are
unchanged. Fixes #488.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reply answers memtier's own HELLO, so the quoted command name need
not be checked: any -ERR unknown command covers servers that word it
differently. The RESP3 note now says when Redis added HELLO rather than
what every server requires. The RESP3 test's peer echoes '3'.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep both scripted-peer options (reject_data from #894, hello_error from
this PR) and both sets of new tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fcostaoliveira
fcostaoliveira merged commit e8850c9 into master Oct 26, 2026
58 of 59 checks passed
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.

Only send HELLO when the server supports it (avoid breaking RESP2 against pre-6.0 servers)

1 participant