Skip to content

ci: parallelize the sanitizer OSS-CLUSTER test cells - #402

Merged
fcostaoliveira merged 1 commit into
redis:masterfrom
filipecosta90:chore/parallelize-sanitizer-cluster-cells
May 29, 2026
Merged

fcostaoliveira merged 1 commit into
redis:masterfrom
filipecosta90:chore/parallelize-sanitizer-cluster-cells

Conversation

@fcostaoliveira

@fcostaoliveira fcostaoliveira commented May 29, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The slowest CI matrix cell — ASAN OSS-CLUSTER API: TCP TLS — runs the full test suite under ASAN + a 3-node cluster + TLS, and has crept to the edge of its 15-minute "Run tests" step timeout as this release added several cluster-heavy test files (mget-cluster, cluster-transaction, transaction-pipeline, monitor-cluster-backpressure, monitor-cluster). On master (893006e) it is already failing this cell at 15m52s, and the other sanitizer cluster cells are all jammed against the cap.

Change

Use RLTest's built-in --parallelism to run tests concurrently — each worker gets its own redis env on a distinct port range — roughly halving wall-time for the cluster cells:

  • tests/run_tests.sh: append --parallelism $PARALLELISM when the PARALLELISM env var is set. Unset = serial (unchanged default); documented in the help text.
  • asan.yml / tsan.yml / ubsan.yml: set PARALLELISM: "2" on the OSS-CLUSTER matrix entries only (5 cells total). Standalone cells are fast and stay serial, so the extra per-runner resource pressure from concurrent sanitized processes is confined to the cells that need the headroom.

Why parallelism (Option A) over matrix sharding

--parallelism is a one-flag, in-job change with no test-file bookkeeping and no extra runner minutes. N=2 keeps memory/CPU pressure modest on the 4-core/16 GB ubuntu-latest runners (2 concurrent envs). If a cell ever needs more isolation, a matrix shard axis is the follow-up.

This complements (doesn't replace) keeping individual cluster tests lean.

Results (measured)

Serial baseline = master 893006e (this PR's exact base, run serially) vs this PR's parallel run — same tests, only --parallelism 2 differs:

Cell Serial (master) Parallel (this PR) Speedup
ASAN cluster Plaintext 13m17s 6m55s 1.92×
ASAN cluster TLS 15m52s ❌ (timeout) 8m23s ✅ 1.89×
TSAN cluster Plaintext 13m48s 7m18s 1.89×
UBSan cluster Plaintext 12m45s 7m04s 1.80×
UBSan cluster TLS 14m37s 8m01s 1.82×
  • Job-total speedup is ~1.8–1.9×. The test-execution phase is closer to a true 2× — each job total still carries ~1.5–2 min of non-parallelizable fixed setup (checkout, artifact download, redis/deps install, TLS cert gen) that doesn't shrink.
  • The previously failing ASAN OSS-CLUSTER TLS cell (15m52s timeout) now passes at 8m23s.
  • No new flakiness observed across any of the 5 cluster cells; full run was green (64 pass, 1 skip, 0 fail).

Test plan

  • All sanitizer OSS-CLUSTER cells pass with comfortable margin under the 15-min cap (parallelism effective).
  • No new flakiness from concurrent envs (port allocation / resource contention).
  • Standalone cells unchanged (serial).

🤖 Generated with Claude Code

The slowest CI matrix cell, ASAN "OSS-CLUSTER API: TCP TLS", runs the full test
suite under ASAN + a 3-node cluster + TLS and has crept to the edge of its
15-minute "Run tests" step timeout as this release added several cluster-heavy
test files; it will exceed the cap as more land.

Use RLTest's built-in --parallelism to run tests concurrently (each worker gets
its own redis env on a distinct port range), roughly halving wall-time for the
cluster cells:
- run_tests.sh: append `--parallelism $PARALLELISM` when the PARALLELISM env var
  is set (unset = serial, unchanged default); documented in the help text.
- asan.yml / tsan.yml / ubsan.yml: set PARALLELISM=2 on the OSS-CLUSTER matrix
  entries only. Standalone cells are fast and stay serial, so the extra
  per-runner resource pressure from concurrent sanitized processes is confined
  to the cells that actually need the headroom.

This complements (does not replace) keeping individual cluster tests lean.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@fcostaoliveira
fcostaoliveira merged commit 3da9f4c into redis:master May 29, 2026
65 checks passed
@fcostaoliveira fcostaoliveira added this to the 2.4 milestone Jun 1, 2026
fcostaoliveira added a commit to filipecosta90/memtier_benchmark that referenced this pull request Jun 1, 2026
PR redis#402 added PARALLELISM=2 to the sanitizer (ASAN/UBSan/TSAN) cluster
cells because cluster bootstrap + serial RLTest pass routinely hit the
workflow's 15-minute step ceiling. The regular Test workflow's
OSS-CLUSTER cells were not updated at the time and have been a known
master flake ever since (~3/8 master runs fail at the same 15-minute
mark; deep-CI investigators on PRs redis#425 / redis#427 / redis#430 / redis#431 all
confirmed the pattern).

Add PARALLELISM=2 to the two affected cells:
  - OSS-CLUSTER API: TCP Plaintext
  - OSS-CLUSTER API: TCP TLS

The 49/99-shard mega-cluster cells already use a single targeted test
(TEST=test_rate_limited_completion_no_hang), so they're under budget
without parallelism.

Bundled with PR redis#430 because that PR was being blocked by exactly this
flake on its final CI run.
fcostaoliveira added a commit that referenced this pull request Jun 1, 2026
…--key-pattern=G:G) (Refs #426 phase 3) (#430)

* fix(opts): validate sampler configs (--data-size-list, --key-stddev, --key-pattern=G:G)

Reject sampler configurations that can never produce a value at parse /
construction time instead of hanging the worker loop or tripping the
Gaussian assert:

  - --data-size-list entries with weight 0: the size sampler would skip
    them and (if every bucket is zero-weight) spin forever picking
    nothing. Issue #426 item 10.

  - --key-stddev must be finite and > 0: NaN compared false against the
    previous "<= 0" guard, and +/-inf produced a Gaussian rejection
    sampler that never satisfied its range constraint. Issue #426
    item 15.

  - --key-pattern=G requires key-maximum - key-minimum >= 2: the
    Gaussian distribution asserts median > min && median < max, which
    is impossible on a 1-key range. SIGABRT before the fix. Issue #426
    item 16.

All three paths now emit a readable error and exit with code 2 (the
parser-error convention used elsewhere in memtier_benchmark.cpp).

Regression coverage in tests/test_cli_validation_sampler.py exercises
each rejection plus a healthy G:G config to guard against false
positives.

Refs #426

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(opts): relax G-range cutoff to max <= min, add median bounds check

Review fix on #430 (correctness reviewer): the original `(max - min) < 2`
cutoff rejected the perfectly valid 2-key Gaussian case (min=1, max=2).
The sampler computes a default median of `(max - min)/2.0 + min + 0.5`
which for that case is 1.5 -- strictly inside (1, 2), passes the
`assert(median > min && median < max)`.

The actual SIGABRT path was a user passing a `--key-median` that lands
outside (min, max). Fix:
  * Reject only `max <= min` for --key-pattern=G (the truly-degenerate
    single-key case).
  * Additionally validate that any user-supplied `--key-median` lands
    strictly inside `(min, max)`. Default median=0 means "auto-compute"
    and is always safe.

Refs #426 phase 3.

* test(sampler): harden valid-G:G happy path against TLS connection-reset flake

ASAN TLS cells under CI load dropped the first connection mid-
handshake on the happy-path test (3 cells failed identically with
'Connection reset by peer / Maximum reconnection attempts (0)
exceeded'). Make the workload a deterministic 10-request smoke and
add --reconnect-on-error so the rc==0 assertion measures the parser
path that the test exists to verify, not TLS flake.

Refs #426 phase 3.

* test(sampler): make valid-G:G happy path TLS-environment agnostic

The previous hotfix (--reconnect-on-error + --max-reconnect-attempts=5)
still relied on a successful TCP/TLS connection, but the test harness
does not inject --tls/--cert flags here, so on TLS-only CI cells
(ASAN/TSAN/UBSan TCP TLS, OSS TCP TLS v1.2/v1.3) the workload cannot
connect at all and the rc==0 assertion always tripped.

Restructure the assertion to match the test's documented purpose:
verify only that the *parser* accepts the valid G:G config. The
workload's runtime outcome is intentionally ignored.

  - Assert rc != 2 (parser did not reject).
  - Assert none of the Items 10/15/16 rejection diagnostics appear in
    stderr.
  - Bound the run with --connection-timeout=1 and
    --max-reconnect-attempts=1 so a TLS-only environment can't keep the
    subprocess alive past _run_memtier's 10s timeout.

Refs #426 phase 3.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(opts): reject 2-key G:G range that SIGABRTs auto-computed median

The d5b882c relaxation of the G-range cutoff from `(max - min) < 2` to
`key_maximum <= key_minimum` was based on a wrong arithmetic claim in
the accompanying comment: for (min=1, max=2) the auto-computed median
in gaussian_distribution_range is

    median = (max - min) / 2.0 + min + 0.5 = 1/2.0 + 1 + 0.5 = 2.0

so the subsequent `assert(median > min && median < max)` fires
(2.0 < 2 is false) and the process SIGABRTs -- exactly the regression
Item 16 was supposed to prevent. Confirmed locally: with min=1, max=2
the previous build hit the crash-handler bug-report dump.

Restore the original `(max - min) < 2` cutoff (and keep the unsigned-
wrap-safe explicit `key_maximum < key_minimum` clause that d5b882c
added), and rewrite the comment with the correct arithmetic so the
choice of cutoff is auditable. The smallest accepted range is now
(max - min) == 2 (e.g. min=1, max=3 -> auto-median = 2.5).

This re-tightens the parser-reject path picked up by cursor[bot] on
the previous commit; the negative test
`test_key_pattern_g_one_key_range_rejected` continues to pass because
the new diagnostic still contains the substring `key-pattern=G`.

Refs #426 phase 3.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* ci: re-trigger workflows after master-flake noise

The prior run hit the pre-existing master flakes
`Test OSS-CLUSTER API: TCP {Plaintext,TLS}` (15-min step timeout) and
the older workflow can't be partial-reran. Empty commit to force a
fresh run.

* ci: parallelize Test OSS-CLUSTER API cluster cells (mirror PR #402)

PR #402 added PARALLELISM=2 to the sanitizer (ASAN/UBSan/TSAN) cluster
cells because cluster bootstrap + serial RLTest pass routinely hit the
workflow's 15-minute step ceiling. The regular Test workflow's
OSS-CLUSTER cells were not updated at the time and have been a known
master flake ever since (~3/8 master runs fail at the same 15-minute
mark; deep-CI investigators on PRs #425 / #427 / #430 / #431 all
confirmed the pattern).

Add PARALLELISM=2 to the two affected cells:
  - OSS-CLUSTER API: TCP Plaintext
  - OSS-CLUSTER API: TCP TLS

The 49/99-shard mega-cluster cells already use a single targeted test
(TEST=test_rate_limited_completion_no_hang), so they're under budget
without parallelism.

Bundled with PR #430 because that PR was being blocked by exactly this
flake on its final CI run.

---------

Co-authored-by: Claude Sonnet 4.6 <[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.

2 participants