Skip to content

[MOD-16323] Fix flaky macOS x86_64 coordinator tests by capping pytest parallelism - #10499

Merged
nafraf merged 9 commits into
masterfrom
nafraf_mod-16323
Aug 13, 2026
Merged

nafraf merged 9 commits into
masterfrom
nafraf_mod-16323

Conversation

@nafraf

@nafraf nafraf commented Jul 17, 2026 •

Copy link
Copy Markdown
Collaborator

Description

  1. Current:
    Heavy coordinator (cluster-mode) pytests are flaky only on the macOS 26 x86_64 CI runner. That runner is a VM on an old 6-core (12-logical) Intel Mac, and pytest runs nproc = 12 workers. In cluster mode each worker spawns its own SHARDS-shard cluster, so 12 workers = 36 redis processes on 6 physical cores. The oversubscription produced two symptoms: per-test timeouts (e.g. testSynonymsIntensiveLoad exceeding the budget) and ephemeral-port exhaustion (OSError: [Errno 49] bursts across unrelated tests). As a stopgap, the macOS x86_64 test runners had been excluded from the frequent CI gates.

  2. Change:

  • In tests/pytests/runtests.sh, when using the default (nproc) worker count on a macOS 26 x86_64 host and in coordinator mode (REDIS_STANDALONE == 0), cap workers to virtual_cores / 2 (12 / 2 = 6), matching the worker count to the 6 physical cores so oversubscription is bounded instead of scaled by the logical-CPU count. Standalone runs one redis per worker and is unaffected — it keeps the nproc default.
  • Revert CI: skip macOS Intel (x86_64) test runners; keep macOS ARM #10463 to reenable macOS Intel (x86_64) test runners
  1. Outcome:
  • The macOS x86_64 coordinator suite runs green with the cap. Across four CI runs: port-exhaustion errors 0 (was 66), coordinator step ~22m18s at 6 workers
  • Standalone step unaffected at nproc (~5m)
  • An earlier /SHARDS = 4-worker variant was also green but ~8m slower

Which additional issues this PR fixes

  1. MOD-16323

Main objects this PR modified

  1. tests/pytests/runtests.sh — coordinator-only, shard-aware parallelism cap for macOS 26 x86_64

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

CI/test-infrastructure change only — no user-facing behavior change.

@codecov

codecov Bot commented Jul 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.22%. Comparing base (349c7f8) to head (687db67).
⚠️ Report is 59 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10499      +/-   ##
==========================================
- Coverage   82.87%   82.22%   -0.65%     
==========================================
  Files         606      632      +26     
  Lines       80392    82134    +1742     
  Branches    35425    37382    +1957     
==========================================
+ Hits        66627    67538     +911     
- Misses      13430    14250     +820     
- Partials      335      346      +11     
Flag Coverage Δ
flow 84.36% <ø> (+0.36%) ⬆️
unit 55.74% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nafraf
nafraf marked this pull request as draft July 18, 2026 14:08
@nafraf
nafraf marked this pull request as ready for review July 23, 2026 06:01
@nafraf
nafraf requested a review from alonre24 July 23, 2026 06:02
Comment thread .github/workflows/generate-matrix.yml Resolved
@nafraf
nafraf force-pushed the nafraf_mod-16323 branch from 4da32a0 to 7dc9f2b Compare August 7, 2026 16:21
@nafraf
nafraf force-pushed the nafraf_mod-16323 branch from 7dc9f2b to 5316d00 Compare August 8, 2026 17:03
@nafraf nafraf closed this Aug 13, 2026
@nafraf nafraf reopened this Aug 13, 2026
@nafraf
nafraf requested a review from oshadmi August 13, 2026 13:33

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 687db6722d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread tests/pytests/runtests.sh Resolved
@sonarqubecloud

Copy link
Copy Markdown

Comment thread tests/pytests/runtests.sh
# macOS 26 (the version on the frequent CI gates); other macOS versions
# are run rarely and pass today.
if [[ $REDIS_STANDALONE == 0 && "$(uname -s)" == Darwin && "$(uname -m)" == x86_64 ]] &&
[[ "$(sw_vers -productVersion 2>/dev/null | cut -d. -f1)" == 26 ]]; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking suggestion:

The sw_vers == 26 guard works for the current failing lane, but it encodes the runner version rather than the resource constraint causing the flake. We could make this age a bit better by capping macOS x86_64 coordinator runs to the physical CPU count when that is lower than nproc:

parallel="$(nproc)"

if [[ $REDIS_STANDALONE == 0 && "$(uname -s)" == Darwin && "$(uname -m)" == x86_64 ]]; then
	physical_cores="$(sysctl -n hw.physicalcpu 2>/dev/null)"
	if [[ $physical_cores =~ ^[0-9]+$ && $physical_cores -gt 0 && $parallel -gt $physical_cores ]]; then
		parallel=$physical_cores
	fi
fi

This keeps the existing default behavior, and applies only when the detected physical core count confirms that logical-core parallelism would overdrive the coordinator run.

@nafraf
nafraf added this pull request to the merge queue Aug 13, 2026
Merged via the queue into master with commit 1c5103d Aug 13, 2026
71 of 76 checks passed
@nafraf
nafraf deleted the nafraf_mod-16323 branch August 13, 2026 15:14
@nafraf

nafraf commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

/backport-agent 8.10 8.8 8.6 8.8-rse 8.6-rse

@redisearch-backport-pull-request

Copy link
Copy Markdown
Contributor

🤖 Auto-backport summary

Target Status Backport PR
8.10 clean #11101
8.8 clean #11102
8.8-rse clean #11103
8.6 clean #11104
8.6-rse clean #11105

(PR #10499, 1c5103d19 — generated by the auto-backport workflow.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants