Skip to content

[8.8-rse] [MOD-18502] Move shard and standalone FAIL reply serialization off the main thread - #11553

Merged
redisearch-backport-pull-request[bot] merged 2 commits into
8.8-rsefrom
backport-agent/pr-11541-to-8.8-rse
Sep 27, 2026
Merged

redisearch-backport-pull-request[bot] merged 2 commits into
8.8-rsefrom
backport-agent/pr-11541-to-8.8-rse

Conversation

@redisearch-backport-pull-request

@redisearch-backport-pull-request redisearch-backport-pull-request Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #11541 to 8.8-rse.
Merge commit: 4b9a5820c23e5930041144a7a68f813fd09aa714

Describe the changes in the pull request

Shard and standalone SEARCH/AGGREGATE under ON_TIMEOUT FAIL currently serialize buffered results on the main thread. This moves reply serialization to the worker while preserving complete-chunk collection, so late APPLY/FILTER errors still replace the entire chunk.

Selected FAIL requests use the existing direct serialization path with no reply callback. The blocked-client deadline remains active through encoding; Redis discards the private reply buffer when timeout wins. Cursor completion runs in blocked-client free-data cleanup, freeing timed-out or exhausted cursors and pausing other nonterminal cursors.

This covers RESP2/RESP3, PROFILE, internal shard commands, initial cursors, and cursor READ. RETURN, RETURN_STRICT, coordinator execution, HYBRID, and inline dispatch retain their existing behavior. Serialization uses RETURN's existing spec-lock lifecycle.

Worker metrics count serialization attempts even when timeout discards the reply. When both the timeout callback and worker report a timeout, both increment the module timeout counter.

Backport adaptation: the cursor-dispatch test covers FAIL and RETURN only because RETURN-STRICT is internal-only on 8.8-rse.

Validation on this backport:

  • Assertion-enabled debug build passed.
  • 983 C/C++ unit tests passed.
  • test_blocked_client_timeout and test_config: 203 tests passed, zero failed assertions (Redis 8.9.241).
  • The original ASAN and coverage CI jobs are rerunning on the follow-up commit; they were not rerun locally.

Follows #11534, merged into 8.10.

Which additional issues this PR fixes

MOD-18502

Main objects this PR modified

  • AREQ dispatch, worker completion, and cursor cleanup.
  • Blocked-client assertions allowing a timeout callback without a reply callback.
  • Debug sync points and consolidated blocked-client timeout tests.

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

…e main thread (#11541)

* [MOD-18502] Serialize shard and standalone FAIL replies in the background

* [MOD-18502] Preserve FAIL collection while encoding replies on workers

(cherry picked from commit 4b9a582)
@codecov

codecov Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (8.8-rse@f11471a). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             8.8-rse   #11553   +/-   ##
==========================================
  Coverage           ?   81.21%           
==========================================
  Files              ?      562           
  Lines              ?    76539           
  Branches           ?    30619           
==========================================
  Hits               ?    62164           
  Misses             ?    14087           
  Partials           ?      288           
Flag Coverage Δ
flow 82.34% <100.00%> (?)
unit 52.47% <0.00%> (?)

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T22:08:58.776425Z 5b06a53 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 5b06a53a16

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1947 to +1948
r->useReplyCallback = !r->encodeReplyInBackground;
blockClientCtx.replyCallback = r->useReplyCallback ? QueryReplyCallback : NULL;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Count each FAIL timeout only once

When a FAIL deadline expires after the worker has started, QueryTimeoutFailCallback increments the timeout counter, and this callback-free path then lets the worker reach handleSendChunkError, which increments the same counter again while encoding a reply that Redis discards. The updated assertions at tests/pytests/test_blocked_client_timeout.py:924-926 and :1837-1841 confirm that one timed-out command now adds two to *_total_query_errors_timeout, corrupting monitoring and alert rates. Suppress error-stat updates for the abandoned worker reply, or designate a single timeout owner.

Useful? React with 👍 / 👎.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
5.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@lerman25
lerman25 requested a review from GuyAv46 September 25, 2026 08:54
@redisearch-backport-pull-request
redisearch-backport-pull-request Bot added this pull request to the merge queue Sep 27, 2026
Merged via the queue into 8.8-rse with commit ae7aec4 Sep 27, 2026
48 of 49 checks passed
@redisearch-backport-pull-request
redisearch-backport-pull-request Bot deleted the backport-agent/pr-11541-to-8.8-rse branch September 27, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport This PR was automatically backported by an agent size:L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants