Skip to content

Preserve RLTest diagnostics and retry setup across runner modes - #806

Merged
fcostaoliveira merged 2 commits into
masterfrom
codex/fix641-rltest-diagnostics-20261023
Oct 24, 2026
Merged

fcostaoliveira merged 2 commits into
masterfrom
codex/fix641-rltest-diagnostics-20261023

Conversation

@fcostaoliveira

@fcostaoliveira fcostaoliveira commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

RLTest failure diagnostics raise a second exception under existing-env or -s because those modes do not provide a captured Redis log. Four retry tests also slice CONFIG GET replies as flat lists, which crashes with redis-py's RESP3 dictionary replies before memtier runs.

Root cause

The diagnostic helper assumes every runner owns dbDirPath, _getFileName and a readable UTF-8 log. Retry setup assumes the raw RESP2 CONFIG representation instead of using redis-py's normalized API.

Fix

Check the runner's log capabilities, report unavailable logs without replacing the original assertion, tolerate filesystem read errors and replace invalid diagnostic bytes. Keep ordinary captured log output and the cluster path intact. Use config_get("maxmemory*") at all four retry setup sites, preserving the existing configuration restoration.

No benchmark production code, protocol choice or workload assertions change.

Tests

  • Three permanent diagnostic regressions fail on the baseline with AttributeError, FileNotFoundError and UnicodeDecodeError; 3/3 pass fixed through actual RLTest. They exercise the real failed-count finally path and verify its original failure remains recorded.
  • Paired actual RLTest forced failures: existing-env and -s lose their secondary exception; captured-log control still prints. All deliberate assertions retain exit 1, with no false success.
  • All four existing-env retry tests fail before memtier on baseline; 4/4 pass fixed, including the 45-second drain-grace case. Normal oss retry control also passes. All four existing-env cases restore the owned server's original maxmemory configuration. A separate actual oss/RESP2 check sets allkeys-lru, calls the real retry test, and confirms every maxmemory field is restored (2/2 RLTest tests pass).
  • Measured raw CONFIG replies are dict under existing-env and list under oss; config_get returns dictionaries in both. All servers were private and authenticated. The external validation adapter supplies authentication missing from the pinned runner/test setup; it does not change protocol selection, test assertions or the code under review.
  • Source whitespace and the commit hook pass. Seven independent reviews and final CI/bot gates remain required.

Affected versions

The unguarded Redis-log read was introduced by c9278c0 (#114), affecting 1.3.0–2.5.2 and master. 82dba6a (#207) moved it into the shared failure helper in 2.0.0.

The CONFIG slicing is unreleased master only: introduced by 1c6f7c4 and 50cfd7f through #559, with two later sites from bc7320a (#700) and cde91ea (#724). Source/tag attribution is historical; actual paired execution uses current master 6818fe3 and pinned RLTest with Python 3.14/redis-py 8.1.0. Product binaries are unaffected.

Fixes #641.

🤖 Generated with Claude Code


Note

Low Risk
Test harness and diagnostic helpers only; no memtier binary or production benchmark behavior changes.

Overview
Hardens RLTest failure diagnostics so memtier assertion failures no longer trigger a second exception when Redis logs are missing or unreadable (existing-env, -s, or partial runners). Cluster mode still skips log printing; when a captured log exists, output is read with errors="replace" and OSError is reported without masking the original assertion.

Fixes retry-on-error test setup by replacing raw CONFIG GET list slicing with conn.config_get("maxmemory*") in four OOM scenarios, so setup works with redis-py RESP3 dict replies.

Adds test_harness_diagnostics.py with three regressions that exercise the real assert_minimum_memtier_outcomes finally path (no managed log, missing/unreadable log, non-UTF-8 log bytes). Minor whitespace fix in get_column_csv.

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

@github-actions

Copy link
Copy Markdown

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

Thanks, this is a nice harness cleanup. The debugPrintMemtierOnError change looks right to me. Catching OSError around the log read so it can't replace the original assertion is what we want. The three diagnostic tests use the real assert_minimum_memtier_outcomes finally path rather than mocking it, which is better than I expected.

One question on the retry side. I may be wrong about this, but I don't think config_get() normalizes keys the same way under RESP2 and RESP3. As far as I remember, the RESP2 callback in recent redis-py is just pairs_to_dict(r) with no key decoding, so without decode_responses the keys stay bytes. The RESP3 callback runs str_if_bytes over them. If that's right, in plain oss mode saved ends up keyed by b"maxmemory" / b"maxmemory-policy". The if k in saved: checks in the finally blocks then silently skip the restore, and maxmemory-policy noeviction leaks into later tests. The comment you removed ("Keys come back as bytes without decoded responses") was guarding against this. Did the oss control run actually confirm the policy was restored, or only that the test passed? If it's ambiguous, I think keeping the normalization costs nothing:

saved = {k.decode() if isinstance(k, bytes) else k: v
         for k, v in conn.config_get("maxmemory*").items()}

The same applies to all four sites.

Nitpicking: the trailing-newline fix in include.py is fine, it's just unrelated noise in the diff.

Otherwise this looks good to me. I'd just like the RESP2 restore question settled before it merges.

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

@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

The initial oss control established that the test passed and CONFIG keys had the expected shape; its restoration flag queried the separate existing-env server. I added an actual oss/RESP2 restoration check to settle this directly: set maxmemory-policy=allkeys-lru, call the real test_retry_after_last_request_is_sent, then compare every maxmemory* field. It restores allkeys-lru and the original limits; both discovered RLTest tests pass. The PR description now distinguishes that evidence.

In installed redis-py 8.1.0, the RESP2 CONFIG GET callback is parse_config_get: it applies str_if_bytes to the response items before pairs_to_dict. Independent real-server controls also restore configuration under RESP2/RESP3 with decode_responses both false and true. Thus the four existing string-key restoration loops work with the normalized API; no extra normalization is needed for this runtime. Older supported versions are being checked by the portability reviewer.

Reproducible oss witness and output: https://github.com/redis-performance/memtier-agent-workspace/tree/main/.workspace-memory/reviews/806-owner-evidence/oss-restoration . All tests use owned authenticated servers, and the deliberate diagnostic assertions remain failures. No source change was needed for this check.

@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

The portability review is complete too: actual authenticated Redis controls passed for redis-py 3.0.0 and 3.5.3 on Python 3.10 with both decoding settings, and 8.1.0 on Python 3.14 with RESP2/RESP3 and both settings (8/8). Each control changed maxmemory and eviction policy, then used the unchanged string-key restoration loop and verified the original values. The historical RESP2 callbacks also explicitly apply nativestr before building the CONFIG dictionary. No extra key normalization is required across the tested supported versions.

Evidence: https://github.com/redis-performance/memtier-agent-workspace/blob/main/.workspace-memory/reviews/806-build.md . All seven independent reviews now approve the unchanged head; full CI remains a merge gate.

Picks up #812, the reconnect deadline-clock fix for the never-started
client test that failed this branch's plaintext job, plus #828, #838 and
#841.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fcostaoliveira
fcostaoliveira merged commit 4bee42e into master Oct 24, 2026
151 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.

tests: harness crashes under RLTest --env existing-env and -s (dbDirPath / missing redis log, CONFIG GET reply sliced as a list)

1 participant