Skip to content

[8.4] MOD-14268: Fix coordinator deadlock under mixed FT.SEARCH + FT.AGGREGATE load (#8774)#9161

Merged
oshadmi merged 3 commits into8.4from
nafraf-backport-8774-to-8.4
Apr 26, 2026
Merged

[8.4] MOD-14268: Fix coordinator deadlock under mixed FT.SEARCH + FT.AGGREGATE load (#8774)#9161
oshadmi merged 3 commits into8.4from
nafraf-backport-8774-to-8.4

Conversation

@nafraf
Copy link
Copy Markdown
Collaborator

@nafraf nafraf commented Apr 17, 2026

Backport #8774 to 8.4

(cherry picked from commit 9f2f1bb)

Release Notes

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

Note

Medium Risk
Touches coordinator concurrency and lifetime management (MRCtx refcounting, unblock/free callbacks, RQ completion timing), so mistakes could cause leaks or use-after-free, but the change is targeted and includes a new stress regression test.

Overview
Fixes a coordinator-side deadlock that could occur under heavy mixed FT.SEARCH + FT.AGGREGATE load by making MapReduce request lifecycle management safe across async handoffs.

This introduces atomic refcounting for MRCtx, moves RQ-slot completion to the fanout completion path (including the 0-shard-reply case), and reworks distributed search to parse/build MRCtx on the main thread with explicit privdata cleanup to avoid double replies and premature frees. Adds FT.DEBUG COORD_THREADS STATS (via new ConcurrentSearch_getStats) and a regression test that drives the coordinator to saturation and verifies the burst drains without hanging.

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

@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented Apr 17, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

❌ Patch coverage is 95.55556% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.55%. Comparing base (21e81be) to head (2b43639).
⚠️ Report is 10 commits behind head on 8.4.

Files with missing lines Patch % Lines
src/module.c 93.87% 3 Missing ⚠️
src/concurrent_ctx.c 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              8.4    #9161      +/-   ##
==========================================
- Coverage   85.61%   85.55%   -0.07%     
==========================================
  Files         337      337              
  Lines       53595    53647      +52     
  Branches    11023    11023              
==========================================
+ Hits        45884    45896      +12     
- Misses       7568     7608      +40     
  Partials      143      143              
Flag Coverage Δ
flow 84.48% <95.55%> (-0.15%) ⬇️
unit 51.12% <0.00%> (-0.05%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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 requested a review from oshadmi April 17, 2026 05:16
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a481e5f. Configure here.

Comment thread src/coord/rmr/rmr.c
@nafraf nafraf force-pushed the nafraf-backport-8774-to-8.4 branch from a481e5f to 2b43639 Compare April 21, 2026 14:10
@sonarqubecloud
Copy link
Copy Markdown

@oshadmi oshadmi added this pull request to the merge queue Apr 26, 2026
Merged via the queue into 8.4 with commit e694529 Apr 26, 2026
37 checks passed
@oshadmi oshadmi deleted the nafraf-backport-8774-to-8.4 branch April 26, 2026 17:59
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