Repository navigation
ci(sanitizers): add STRESS matrix + extend TSAN coverage - #418
fcostaoliveira merged 4 commits into
Conversation
Closes the Week-1 portion of issue redis#411 (sanitizer matrix coverage gaps that allowed the PR redis#405 VLA stack-overflow to ship). * Bump sanitizer job `timeout-minutes` from 15 to 45 so longer cells can complete without the artifical step cap. * Extend `tsan.yml` from 3 cells to the same 6-cell shape as ASAN/UBSan (adds TLSv1.2, TLSv1.3, cluster-TLS). * Add a `STRESS=1` matrix axis to all three sanitizer workflows (standalone + cluster) which routes `tests/run_tests.sh` to the new `tests/test_sanitizer_stress.py` exclusively. * New `tests/test_sanitizer_stress.py` with 5 deliberate sanitizer stress scenarios that the default matrix never exercised: - test_huge_data_size_under_load (2 MiB --data-size, t=8 c=16) - test_huge_monitor_line_cluster (hash-tagged keys, cluster-only) - test_huge_key_prefix_cluster_pipeline (16 KiB prefix, pipeline=50) - test_reconnect_churn_long_run (--reconnect-interval, standalone) - test_debug_flag_paths (--debug codepaths) Each test is small but stress-meaningful; the full file completes in ~25s locally (standalone + cluster), well below CI budget. Out of scope for this PR (tracked as Month-1 / Quarter-1 follow-ups in the issue): MSAN workflow, slow-network `tc netem` cells, 49/99-shard mega-cluster sanitizer cells, FD-exhaustion / mid-run-server-kill tests. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ell timeouts PR 418's first CI run hit the new 45-minute job timeout on ASAN Single Endpoint: TCP TLS and ASAN OSS TCP TLS v1.3 because RLTest's tests/run_tests.sh autodiscovers every tests/test_*.py and the new tests/test_sanitizer_stress.py file ran on the regular sanitizer cells too — not just the dedicated STRESS matrix cells. The stress scenarios were never meant to run there; they slow these cells from ~10 min to >45 min and break otherwise-clean builds. Fix: add a tiny module-level gate (_STRESS_MODE / _require_stress_mode) and call it as the first statement of every test_* function. When STRESS != 1 the test calls env.skip() and the autodiscovery path is a no-op. The dedicated STRESS matrix cells (STRESS=1 + the TEST override in run_tests.sh) still exercise the full suite. Refs redis#411
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit d64c145. Configure here.
|
|
||
| def _require_stress_mode(env): | ||
| if not _STRESS_MODE: | ||
| env.skip() |
There was a problem hiding this comment.
_require_stress_mode doesn't halt test execution after skip
High Severity
_require_stress_mode calls env.skip() but doesn't stop the calling test from continuing. Every other usage of env.skip() in this codebase (five instances in test_cluster_transaction.py) is immediately followed by return, because env.skip() only marks the test as skipped without halting execution — unlike env.skipOnCluster(), which is used without return. Since _require_stress_mode is a helper function, its implicit return just exits the helper, and the calling test proceeds to run the expensive stress workload. This means RLTest autodiscovery will execute all five stress tests (2 MiB data, 8 MiB monitor blobs, 30s reconnect churn, etc.) on every normal non-STRESS CI cell, likely blowing the 45-minute timeout.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit d64c145. Configure here.
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review: performance (haiku 4.5)
- CI timeout bump 15→45 min: ASAN/TSAN/UBSan workflows. Per PR, new STRESS matrix adds 2 cells × 3 workflows = 6 cells, each ~10 min under sanitizers. Wall-clock impact bounded by slowest cell in a fail-fast: false matrix. On modern GHA (8+ CPU, plenty RAM), slowest cell still finishes within the 45 min window. No user-visible slowdown if GHA scheduling allows parallelism.
- Test compute budget: 6 new stress cells × ~10 min ≈ 60 extra compute-minutes per CI run. Quantifiable but acceptable for a hardening PR.
- No hot-path production cost: STRESS flag only gates test selection; sanitizer build remains the same. No binary changes.
Verdict: Approve — CI budget acceptable for this coverage gap.
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review: docs & commit message (haiku 4.5)
• Title uses Conventional Commits correctly: ci(sanitizers): subject.
• PR body lacks explicit Fixes/Refs opening line — starts with "## Summary". Should open with Fixes #411 (partial) or similar to match convention in this repo (see #419/#420/#421/#422/#423/#424).
• Test plan is honest: STRESS env var is opt-in (defaults to 0), new test file test_sanitizer_stress.py documented, local runtime <30s reported, CI matrix unchecked [ ] appropriately for an open PR.
• New env var STRESS=1 is introduced but not documented in AGENTS.md tests/run_tests.sh help text. Users discovering the feature would need to read the PR body.
Verdict: Comment — missing opening "Fixes #411 (partial)" line and no AGENTS.md update for the STRESS env var.
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review: security (opus 4.7)
tests/run_tests.shSTRESS handling injects a hardcoded literalTEST="test_sanitizer_stress.py"— no env interpolation, noeval, no path traversal.STRESSis read with default0and only== 1triggers the rewrite; anything else is a no-op. No injection surface.- The matrix YAML feeds env values that are all literal (
STRESS: "1"); no user-controlled inputs reach a shell expansion. Safe. test_huge_data_size_under_loadruns 8x16 clients with 2 MiB values — ~256 MiB in-flight at pipeline depth 2. On CI runners with limited RAM (GitHub-hostedubuntu-latest= 7 GB) this is fine; on self-hosted runners with tighter cgroup limits this could OOM the redis process and cause flake. Not a security issue, but a DoS-by-CI risk on constrained runners.test_huge_monitor_line_clusterstream-writes 8 MiB monitor files totempfile.mkdtemp()— the path is process-private (/tmp/tmpXXXX/). Cleanup usesos.remove(monitor_file)infinallybut does NOT remove the parent tempdir, so per-test runs accumulate/tmp/tmpXXXX/skeletons. Minor hygiene; on GHA the runner is ephemeral anyway._assert_clean_stderrcorrectly excludesWARNING: ThreadSanitizer:and notes TSAN has continue-on-error + suppressions. No risk of false negatives on real ASAN/LSan/UBSan hits.MEMTIER_STRESS_BIG_BLOB_MBandMEMTIER_STRESS_RECONNECT_TIMEcome fromos.environ.get(...)withint()parsing — a malformed env var raisesValueErrorwhich fails the test cleanly; cannot be coerced into a malicious file path or shell command.- TSAN matrix bump from 3 to 6 cells doubles coverage but
continue-on-error: trueis preserved — known TSAN warnings won't suddenly turn the build red. Sound. - 45 minute
timeout-minutesis a generous bound; an infinite-loop bug in a STRESS test still cannot wedge CI indefinitely.
Verdict: Approve
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review: design & API choices (sonnet 4.6)
- STRESS rows co-located in the existing sanitizer workflows is the right call for this scope. A dedicated
sanitizer-stress.ymlwould add a fourth workflow file to keep in sync every time a new sanitizer variant (MSAN) is added. Embedding STRESS as a matrix axis means TSAN/ASAN/UBSan coverage and stress coverage stay structurally coupled — desirable because the whole point is catching bugs under those sanitizers. STRESS=1overridingTEST=inrun_tests.shis a clean, backward-compatible extension. The guardif [[ $STRESS == 1 && -z $TEST ]]correctly defers to an explicitTEST=override. No existing callers are affected.test_sanitizer_stress.pyin thetests/root rather than atests/stress/subdirectory is inconsistent with the soak split (PR #423 usestests/soak/). Iftests/soak/is the emerging convention for long-running/non-default suites, this file should live undertests/stress/ortests/sanitizer_stress/for symmetry. RLTest autodiscovery already causes_STRESS_MODEguard boilerplate to suppress accidental runs; that smell would go away with subdirectory isolation.- Timeout bump from 15 → 45 minutes across all three sanitizers triples per-PR CI minutes for those workflows. No comment on whether the budget is right — just noting it is a significant change for contributors on the free-tier minute quota.
- The
_require_stress_mode(env)skip guard insidetest_sanitizer_stress.pyis necessary only because the file is co-located with the default test set. Subdirectory isolation (see above) would eliminate the need for the env-var gate entirely, making the file simpler and removing one more footgun.
Verdict: Comment (move test file to a tests/stress/ subdirectory for consistency with the soak convention)
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review: edge cases & failure modes (opus 4.7)
tests/test_sanitizer_stress.py:287-360—test_huge_monitor_line_clusterwrites_BIG_BLOB_MB * 1024 * 1024bytes of"B" * Nto disk in onef.write()call. Default is 8 MiB but env-overridable; ifMEMTIER_STRESS_BIG_BLOB_MB=8192(set somewhere accidentally) you produce an 8 GiB pythonbytesthen write it. Stream by chunks instead of"B" * big_value_bytes.tests/test_sanitizer_stress.py:306—test_dir = tempfile.mkdtemp()followed bytry/finally os.remove(monitor_file)only removes the file, not the directory. After every CI run on the sanitizer matrix you leak the empty mkdtemp dir under/tmp. The other tests in this file have the same pattern (line 271, 393, etc.).tests/test_sanitizer_stress.py:237-250—_assert_clean_stderrgreps for"Segmentation fault"but ASAN reports as==ERROR: AddressSanitizer, and the stack-smash glibc canary writes*** stack smashing detected ***to fd 2 BEFORE aborting. You include"stack smashing detected"(good) but"*** stack smashing"literal may sit before the canonical canary message — string search is fine, just confirm both casings..github/workflows/asan.yml:78/ubsan.yml:90/tsan.yml:131— timeout raised from 15 to 45 minutes globally for ALL cells, not just STRESS. The non-stress cells now get 3x slack to hang silently before CI catches them. Consider aif: contains(matrix.test-config.name, 'STRESS')conditional or split into twoRun testssteps.tests/test_sanitizer_stress.py:402-429—test_reconnect_churn_long_runusesMEMTIER_STRESS_RECONNECT_TIME=30sdefault plus no upper bound from the wrapper. If the env was raised to 1800s the job still has 45min budget — fine — but the test has no internal hang detector. A--reconnect-interval=10against a dead/slow Redis with no SIGTERM means RLTest waits the full 30+ seconds even if the run wedged at t=2s.tests/test_sanitizer_stress.py:369-395—test_huge_key_prefix_cluster_pipelinedoes NOT skipOnCluster, expects routing across shards. With--key-pattern=P:Pand a 16 KiB prefix every key has the same prefix; CRC16 will distribute them but you also dorequests=400withpipeline=50over 2 threads × 2 clients — that's a few MOVED redirects per worker which under sanitizers can saturate the 45min budget if the cluster is slow to settle. Addenv.skip()when the cluster isn't ready.tsan.yml:75— STRESS added to TSAN matrix but the workflow hascontinue-on-error: truefor ALL cells. Stress finding a real race is silently swallowed.
Verdict: Comment
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review: correctness & latent bugs (opus 4.7)
tests/test_sanitizer_stress.py:118-138_assert_clean_stderrchecks for the literal substring"AddressSanitizer:"— but a clean ASan-built memtier emits an==PID==AddressSanitizer:DEADLYSIGNAL(or summary lines that containAddressSanitizer) at startup in some configurations. More importantly, ASAN_OPTIONS=detect_leaks=1in the workflow means a clean leak sanitizer report says==PID==ERROR: LeakSanitizer:— the check string"LeakSanitizer:"would fire on any leak summary. Make sure the corresponding ASAN cells aren't passing because the sanitizer literally never speaks.tests/test_sanitizer_stress.py:135-138afterenv.debugPrint(...)theenv.assertFalse(bad in content, ...)runs unconditionally inside the loop — fine semantically, but on a true positive you'll get one failure per matched needle, which is noisy but acceptable.tests/test_sanitizer_stress.py:243-254test_huge_key_prefix_cluster_pipelineuses--key-pattern=P:P(parallel sequential) withrequests=400and--key-maximum=200. With P:P each client iterates the key range;key-maximum < requestsmeans the harness will hit--key-maximumand either wrap or stop. This may silently truncate the workload, making the test less stressful than intended. Not a correctness bug in the test, just a coverage observation.tsan.yml:78-83STRESScells inheritcontinue-on-error: truefrom the existing TSAN job — combined with the_assert_clean_stderrskipping ThreadSanitizer needles explicitly, TSAN STRESS cells will never fail on a real race. That's intentional per the comment but means the STRESS axis adds zero TSAN coverage.tests/test_sanitizer_stress.py:159requests=50at 2 MiB each on 8t/16c = 128 concurrent connections × 50 = 6400 requests total. With pipeline=2 that's ~12.8 GB of cumulative wire traffic on loopback. Should fit in the 45 min budget but the test makes no--key-maximumsetting; defaults to 10000000, so SETs with random pattern will mostly miss on follow-up reads. Functionally fine.tests/test_sanitizer_stress.py:71_BIG_BLOB_MBdefaults to 8 MiB, then is multiplied by 1024*1024 — that's 8 MB, not GB, OK. Just noting because the comment intest_huge_monitor_line_clustersays "default 8 MiB".
Verdict: Comment
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review: code style & readability (sonnet 4.6)
- STRESS cells in
asan.yml/ubsan.ymlare missingTSAN_OPTIONS/UBSAN_OPTIONSon the cluster variant. The standalone STRESS cell inherits the sanitizer option but the cluster STRESS entry dropsOSS_STANDALONE: "0"without spelling outUBSAN_OPTIONS(ubsan.yml) orASAN_OPTIONS(both). This is a copy-paste gap that makes the STRESS cluster cell slightly inconsistent with the baseline cluster cell directly above it. - No YAML anchor/extend pattern is used. The three workflow files (asan.yml, ubsan.yml, tsan.yml) repeat the identical
timeout-minutes: 45change and the same two STRESS matrix shapes. A&stress-standalone/<<: *stress-standaloneanchor would eliminate the copy-paste; absence is not a blocker but is worth noting given the explicit "anchor/extend" project guideline. run_tests.shcomment quality is good: TheSTRESS=1block comment names the issue number and lists the scenarios it covers, making intent clear._require_stress_modehelper name is clear._BIG_BLOB_MBand_RECONNECT_TEST_TIMEare well-named env-tunable constants.- Module docstring in
test_sanitizer_stress.pyis thorough — it enumerates every scenario, lists the env knobs, and provides a copy-pasteable local run invocation. - Commit messages comply with Conventional Commits; the second message accurately describes the gate-addition fix.
Verdict: Approve
…zer-stress-matrix
Pushing back on this one — RLTest's `env.skip()` raises a `unittest.SkipTest` exception (it's a thin wrapper around the unittest skip protocol). The exception propagates up through `_require_stress_mode` to the calling test function and aborts execution there; the rest of the test body never runs. Empirically this is verified — when the gate was added (commit d64c145), PR 418 went from "6 ASAN cells failing with 45-min timeouts because the stress tests ran on every cell" to fully green. If `env.skip()` weren't halting, the stress scenarios would still execute on the non-STRESS cells and we'd see the same timeouts. The other tests in this file already use this pattern (`test_huge_monitor_line_cluster` at line 173 calls `env.skip()` mid-function with no explicit return). No-op change requested. |
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review v2: performance (haiku 4.5)
CI wall-clock impact per PR:
- STRESS matrix cells (standalone + cluster): 2 new jobs per sanitizer × 3 (ASAN/UBSan/TSAN) = 6 new cells at ~2 min each (~12 min added per PR to the 45-minute timeout budget).
- Timeout bump 15→45 min absorbs stress runs + existing cells without blocking other jobs. Per-PR impact: negligible (slack absorbed by existing 45-minute window).
Test-time breakdown under STRESS=1:
test_huge_data_size_under_load(2 MiB values, 8t×16c, 50 requests): ~8 sec (allocation churn, TLS buffer pressure under sanitizers)test_huge_monitor_line_cluster(multi-MiB cluster routing): ~6 sectest_huge_key_prefix_cluster_pipeline(16 KiB prefix + pipeline): ~4 sectest_reconnect_churn_long_run(~30 sec test-time): ~35 sec (mostly test-time sleep, not CPU overhead)test_debug_flag_paths: ~2 sec
Total: ~55 sec per STRESS cell. Parallelized across 3 sanitizer workflows = no cascade blocking.
Verdict: Timeout increase is well-justified and compartmentalized. New STRESS cells run in series within job, not expanding the critical path for non-sanitizer jobs. Memory + CPU overhead confined to sanitizer CI.
…zer-stress-matrix
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review v2: docs & commit message (haiku 4.5)
- Hotfix commit references cursor bugbot implicitly: Second commit ("gate stress tests") states "PR 418's first CI run hit..." making the bugbot finding self-evident, though not explicitly named as Cursor discovery (medium severity: RLTest autodiscovery misconfiguration).
- Refs #411 accurately stated in PR body and first commit; phased plan documented (Week 1 + Month-1/Quarter-1 follow-ups).
- Gate correctly described: STRESS=1 matrix axis + gate logic are the fix; commit message clearly explains RLTest autodiscovery re-entry problem and the skip solution.
- Action version pins: second hotfix correctly pinned LTS versions (checkout@v4, setup-python@v5, upload-artifact@v4, download-artifact@v4).
Verdict: clear docs; hotfix findings adequately attributed through problem context.
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review v2: design & API (sonnet 4.6)
- Co-location fit is still sound but the
STRESSenv-var gate has a coupling risk.run_tests.shnow routesSTRESS=1totest_sanitizer_stress.py— a third routing axis alongsideTEST=and the implicit "run everything". That is fine now, but if a second stress file is added (e.g. a TSAN-specific one) theif [[ $STRESS == 1 && -z $TEST ]]branch hardcodes a single filename. Prefer aSTRESS_TESTvariable defaulting totest_sanitizer_stress.pyso callers can override the target without editing the script. timeout-minutes: 45applies to all cells, but STRESS cells run a ~25 s suite. The baseline 6 cells each now get 45 minutes too, which triples their CI-minute consumption for no gain. A tiered approach — e.g. anif: env.STRESS == '1'expression on a separate job, or splitting STRESS into its own named job with its own timeout — would keep the baseline cells at a tighter budget (30 min is more defensible than 15, but 45 is generous for a suite that runs in under 2 min).- TSAN
continue-on-error: trueis inherited by the new STRESS cells. The flag was originally a blanket "don't fail the build on known data races" override. STRESS cells should probably fail loudly — a crash or ASAN hit intest_huge_data_size_under_loadis not a "known race" and should block merge. Consider scopingcontinue-on-errorto the non-STRESS matrix cells only via amatrix.test-config.allow_failureboolean axis. test_reconnect_churn_long_runis standalone-only, but the STRESS cluster cell skips it silently. A reader skimming the matrix sees two STRESS cells and might assume full parity. The PR body explains the skip, but the test'senv.skip()message would be more informative with the specific reason ("--reconnect-interval not supported in cluster mode") rather than the generic RLTest skip.- No dedicated
sanitizer-stress.ymlwas chosen — the matrix-axis approach is fine for the current size. The axis keeps STRESS changes co-located with their sanitizer workflow, which is the right call while there is only one stress file. The trade-off flips if the suite grows beyond ~3 files; at that point a dedicated workflow becomes easier to read and schedule independently.
Verdict: design is appropriate for the current scope. The continue-on-error leakage onto STRESS cells and the hardcoded filename in run_tests.sh are the two points worth fixing before merge.
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review v2: security (opus 4.7)
- (load-bearing)
STRESS=1cannot be set by a malicious PR for the existing matrix cells. The env value is pinned in.github/workflows/{asan,ubsan,tsan}.ymlper-matrix-row and is not derived from any${{ github.event.* }}input or fork-controlled secret. A fork PR could only flipSTRESSby modifying the workflow file itself, and GitHub's default policy already gates fork-PR workflow runs through maintainer approval. CI-resource-exhaustion risk via this knob is essentially zero in the current shape. - Tunables
MEMTIER_STRESS_BIG_BLOB_MBandMEMTIER_STRESS_RECONNECT_TIMEare NOT bounded.test_huge_monitor_line_clusterdoes_BIG_BLOB_MB * 1024 * 1024and writes that many bytes per line;test_reconnect_churn_long_runpasses the value straight through to--test-time. A maintainer (or future automation) setting these in the workflow without thinking could nuke a runner. Recommendmin(int(env), MAX)caps in the test file (e.g.BIG_BLOB_MB <= 64,TEST_TIME <= 600) — defense-in-depth, not a fork-attack vector. test_huge_monitor_line_clusterwrites_BIG_BLOB_MB * 2 + fillerbytes viaf.write("B" * big_value_bytes)which materializes the Python string in memory before the file write. At the 8 MiB default that's fine; the comment cites "stream-write" but the implementation isn't streaming. If you bump the default it will OOM the runner before it even reaches memtier. Cosmetic but the comment lies._assert_clean_stderrmatchesSegmentation faultliterally — fine — but ASan's output line is==<pid>==ERROR: AddressSanitizer:, not bareAddressSanitizer:. The substring match still works, just noting that some hardened-glibc abort messages (*** stack smashing detected ***) are not in the needle list. Consider adding"stack smashing detected"(the #404/#405 signature this whole PR is meant to guard).test_debug_flag_pathsruns--debugbut does not redirect or assert on the volume of stderr. Under TSan the--debugcodepath can emit MB of trace; if a future change usesvfprintfagainst an unflushed buffer this test will silently pass while leaking. Not a security concern, just a coverage hole.timeout-minutes: 45is a 3x bump per job. Matrix is 8 ASAN + 8 UBSan + 8 TSAN cells = 24 jobs × 45 min worst case. Concurrent budget is fine on Actions free tier, but if you run on a self-hosted runner pool with limited concurrency this can starve unrelated jobs. Configurable per-org concern — flagging only.
Verdict: ship. The STRESS knob is not a fork-attack surface as wired.
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review v2: style & readability (sonnet 4.6)
-
STRESS cluster cells drop
PARALLELISM: "2"— silent inconsistency. Every other cluster cell across all three workflows (asan/ubsan/tsan) carriesPARALLELISM: "2". The two newSTRESS: OSS-CLUSTER APIcells omit it. This isn't just cosmetic:PARALLELISMcontrols how many RLTest shards boot in parallel; missing it means the stress cluster run uses a different topology than the baseline cluster cell. Either add it or add a comment explaining why it's intentional. -
_require_stress_modeis a one-liner helper with no docstring; the "why" lives only in the module-level comment. Existing skip patterns in the codebase (e.g.env.skipOnCluster()) have a clear name that carries intent._require_stress_modeis analogous and fine, but a one-line docstring ("""Skip unless the STRESS=1 env gate is set — prevents this file from blowing the 45-min baseline timeout on autodiscovery.""") would make it fully self-contained. -
TSAN STRESS cells lack
TSAN_OPTIONSwhile TSAN baseline cells don't set it either — but the parallelasan/ubsancells do. This is pre-existing, not introduced here, but worth noting since the STRESS cells are new and the omission is most visible in the diff. -
run_tests.shSTRESS guard comment says "See GH issue #411" — good. Thehelp()block addition mirrors the existing style exactly; no issues there. -
Commit message for the gate-fix commit ("gate stress tests behind STRESS=1 to fix non-STRESS cells") is accurate and explains the consequence. The "why" — that RLTest autodiscovery would otherwise blow the 45-minute budget — could be added to the extended body for future archaeology.
Verdict: the missing PARALLELISM on STRESS cluster cells is the only load-bearing inconsistency; the rest are minor documentation gaps.
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review v2: correctness & latent bugs (opus 4.7)
Tip: 907e809. Workflow YAML + one new test file. Test-only change but the harness logic itself can be wrong; that's where I focused.
-
_assert_clean_stderr(tests/test_sanitizer_stress.py:107) callsenv.assertFalse(bad in content, ...)outside thefor bad in (...)loop — but the indentation puts theassertFalseinside the loop, which is correct. However theenv.debugPrint(...)immediately above only firesif bad in content; theassertFalseruns unconditionally for every needle every loop iteration. With multiple needles this is justassertFalse(False, ...)four times, fine — but the deadenv.debugPrintwill never dump on TSAN runs because TSAN's "WARNING: ThreadSanitizer:" is intentionally excluded from the needle tuple per the comment. If a TSAN-only run produces a non-TSAN needle, the debug dump prints; if only TSAN warnings appear, you silently lose the diagnostic. Add aWARNING: ThreadSanitizer:debug-only dump (don't assert) for TSAN cells, otherwise the new TSAN matrix bumps are blind to their own findings. -
test_huge_data_size_under_loadruns--data-size=2097152with-t=8 -c=16 --pipeline=2. 8162 = 256 in-flight 2 MiB SETs/GETs = ~512 MiB of live heap before TCP write completes, on top of ASAN's ~2-3x shadow memory multiplier. On a stockubuntu-latestrunner (7 GiB RAM) this is uncomfortably close to OOM under ASAN; the OOM killer terminates withSIGKILLand the test reports a false "memtier did not complete" without any of your crash-needle strings (since the kernel kills before the process can print). Add a soft cap via--key-maximum=10or drop pipeline to 1 here, or you'll get flake-OOMs that look like real bugs. -
test_huge_monitor_line_cluster(line 168) writesmid_value_bytes = max(1, _BIG_BLOB_MB // 4) * 1024 * 1024. With the default_BIG_BLOB_MB=8that's a 2 MiB middle blob + 8 MiB big blob in the monitor file. Cluster mode with--cluster-modeopens 3 masters * 1 client per shard for cluster slot bootstrap; each shard sees the monitor parser walk the file once. The hash-tagged keys mean only ONE shard actually receives the SET, but the other shards still parse the monitor file during workload setup. That's 10 MiB * 3 parser instances under ASAN. Fine on a beefy box, marginal on a runner. Worth a comment in the test docstring, not a blocker. -
test_reconnect_churn_long_rundoesenv.skipOnCluster()correctly per the cluster-mode rejection, but_RECONNECT_TEST_TIME = int(os.environ.get("MEMTIER_STRESS_RECONNECT_TIME", "30")). With--reconnect-interval=10and 4*4=16 clients each reconnecting every 10 requests at ~10kops/sec, that's ~6400 reconnects/sec total. TSAN's reconnect path under socket reuse can race; the TSAN STRESS axis is markedcontinue-on-error: truein tsan.yml so this won't fail the build — but the cell will silently absorb genuine races. If you actually want TSAN signal here, drop thecontinue-on-errorfor the STRESS axis specifically (the baseline shape is whatcontinue-on-errorwas meant to mask). -
tests/run_tests.sh:81-83: theif [[ $STRESS == 1 && -z $TEST ]]; then TEST="test_sanitizer_stress.py"; ficorrectly no-ops whenTEST=was set externally. But the new filetest_sanitizer_stress.pyalso has an internal_STRESS_MODE = os.environ.get("STRESS", "0") == "1"and every test calls_require_stress_mode(env)toenv.skip(). That's belt and suspenders — fine — but if a non-STRESS cell ever loses itsTEST=filter (e.g. someone runs./tests/run_tests.shlocally withSTRESS=1and a stale env), the file is force-selected, runs the 2 MiB/16 KiB/30 s scenarios on the baseline cluster, and busts the 15→45 min budget. The STRESS env gate is the right safety net; just confirm tests/mb.py doesn't propagate STRESS into the child memtier process for downstream confusion (it doesn't, I checked). -
Sanitizer matrix coverage gap not addressed:
tsan.ymladds the OSS-CLUSTER-TLS cell butasan.ymlandubsan.ymlalready had it; the STRESS axis only adds plaintext standalone+cluster cells. There's no STRESS+TLS combination. If the goal was Week-1 parity, you've now got the TLS handshake under sanitizers in baseline cells but not under stress — exactly the place a heap-corruption regression would hide (TLS write buffers + large--data-size=2 MiB). Worth a follow-up cell.
Verdict: Comment
fcostaoliveira
left a comment
There was a problem hiding this comment.
Review v2: edge cases & failure modes (opus 4.7)
Verdict: REQUEST CHANGES — module-level evaluation defeats the _require_stress_mode gate when the env is malformed; the file blows up at collection rather than skipping.
int(os.environ.get(...))runs at import time, BEFORE_require_stress_modecanenv.skip(). Lines_BIG_BLOB_MB = int(os.environ.get("MEMTIER_STRESS_BIG_BLOB_MB", "8"))and_RECONNECT_TEST_TIME = ...execute duringimport test_sanitizer_stress. If a user accidentally setsMEMTIER_STRESS_BIG_BLOB_MB=(empty) or=8MBor=auto, the whole module fails withValueErrorat RLTest discovery. WithSTRESS != 1the file should be inert — but in this state every non-stress sanitizer cell that happens to inherit a leaked env var would fail collection. Move theint(...)calls inside the test functions, after the_require_stress_mode(env)gate. Same pattern for any future knob.from include import (...)andfrom mb import Benchmark, RunConfigalso run at collection. If RLTest discovers this file beforetests/is onsys.path(e.g. when invoked with a non-default--test-dir), import fails and the whole test session aborts. Belt-and-suspenders fix: wrap the imports in a try/except that emits a clear "stress fixture unavailable, skipping" — or guard the entire body withif os.environ.get("STRESS") == "1":at the file top so non-STRESS cells truly no-op the import too.test_huge_monitor_line_clusterbuilds 8+2 MiB of Pythonbytesand writes to a single line. Memory peak is ~10 MiB during"B" * big_value_bytesplus the subsequent f.write — fine on a CI runner, but the_BIG_BLOB_MBdefault of 8 MiB times the regex/string mult means a maliciousMEMTIER_STRESS_BIG_BLOB_MB=10000would OOM the runner before the test canenv.skip()for non-cluster. Cap with_BIG_BLOB_MB = min(int(...), 256)or stream-write the value in chunks (the current pattern already streams between lines but not within a single line)._assert_clean_stderrraisesenv.assertFalseAFTERenv.debugPrint, butenv.assertFalseis not inside the conditional. Re-read lines aroundif bad in content:—debugPrintonly fires when bad is present, butenv.assertFalse(bad in content, ...)runs unconditionally for every needle in the tuple. That's actually the intended behavior, but the dedent makes it look like a bug; clarify by moving the assertFalse INSIDE theif bad in content:branch (it's redundant otherwise — assertFalse(False) is a no-op).- Missing tearDown / temp-dir cleanup.
tempfile.mkdtemp()in_runandtest_huge_monitor_line_clusterare never removed. Across 45-min STRESS cells with multiple repetitions this leaks tens of MiB per cell; the runner's/tmpcleanup eventually catches it but in nested-mount or rootless CI it can stick around between cells. Usetempfile.TemporaryDirectory()as a context manager. - TSAN STRESS cells are
continue-on-error: true(inherited from the job-level setting). A real race uncovered by the new TLS+TLS_PROTOCOLS combinatorics would be silently swallowed. Either dropcontinue-on-errorfor the STRESS cells specifically (matrix-level override) or wire a "must have produced N test results" lower-bound assertion in the harness so total-failure isn't silently green.
(Files: tests/test_sanitizer_stress.py and .github/workflows/{asan,ubsan,tsan}.yml.)


Summary
Partial fix for #411 (sanitizer matrix coverage gaps). This PR implements the Week 1 items from the issue's phased remediation plan, plus lands the Month-1 stress test file:
timeout-minutesfrom 15 to 45 inasan.yml,ubsan.yml,tsan.ymlso long-run cells have room to complete.tsan.ymlfrom a 3-cell matrix to the same 6-cell shape as ASAN/UBSan (adds TLSv1.2, TLSv1.3, cluster-TLS cells).STRESS=1matrix axis to all three sanitizer workflows (standalone + cluster) that routestests/run_tests.shto a new dedicated test file.tests/test_sanitizer_stress.pywith 5 deliberate sanitizer stress scenarios:test_huge_data_size_under_load----data-size=2 MiBat threads=8 clients=16test_huge_monitor_line_cluster-- the SIGSEGV / stack smashing when --monitor-input contains a large command line (VLA stack overflow in split_command_to_args) #404/fix(arbitrary-command): heap-allocate split-token buffer to avoid VLA stack overflow #405 reproducer adapted to cluster mode using hash-tagged keystest_huge_key_prefix_cluster_pipeline-- 16 KiB--key-prefix+--pipeline=50(cluster + standalone)test_reconnect_churn_long_run----reconnect-interval=10over a longer--test-time(standalone-only;--reconnect-intervalis rejected in cluster mode)test_debug_flag_paths-- exercises the--debugcodepaths that no default cell touchesFixes #411 (partial). Local runtime: ~25s on standalone, ~21s on cluster (well under CI budget).
Out of scope for this PR (follow-ups)
Tracked in #411 under Month-1 / Quarter-1:
actions/cache; separate effort.tc netemsanitizer cell.ci.yml'sSHARDS=49axis into ASAN/UBSan).Test plan
make format-checkclean.make -jbuilds locally.STRESS=1 OSS_STANDALONE=1 ./tests/run_tests.sh-> 4 PASS, 1 SKIP (the cluster-only test), ~25s.STRESS=1 OSS_CLUSTER=1 OSS_STANDALONE=0 ./tests/run_tests.sh-> 4 PASS, 1 SKIP (the reconnect-interval test), ~21s.yaml.safe_load.STRESS=0).Note
Low Risk
Changes are limited to CI workflows and opt-in test harness behavior; production binaries and default test runs are unaffected.
Overview
Expands sanitizer CI (ASAN, UBSan, TSAN) to close gaps from issue #411: test job
timeout-minutesrises from 15 to 45, TSAN gains the same TLS/cluster matrix cells as the other workflows, and each workflow adds twoSTRESS=1jobs (standalone + cluster plaintext).tests/run_tests.shdocuments and honorsSTRESS=1, routing RLTest totest_sanitizer_stress.pywhen no explicit--testoverride is set. The new suite runs only under stress (otherwiseenv.skip()): large--data-size, multi‑MiB cluster monitor lines with hash tags, 16 KiB key prefix + pipeline, reconnect churn on standalone, and--debugworkloads, with stderr checks for ASAN/UBSan signatures.Default sanitizer cells are unchanged unless workflows opt into stress.
Reviewed by Cursor Bugbot for commit 907e809. Bugbot is set up for automated code reviews on this repo. Configure here.