[8.4] MOD-14461: Fix FT.EXPLAIN missing spec read lock#8792
Conversation
* MOD-14461: Fix FT.EXPLAIN missing spec read lock RS_GetExplainOutput was calling prepareExecutionPlan without first acquiring a read lock on the index spec, which could lead to race conditions with the GC modifying spec structures (terms, suffix, docs, stats) concurrently. Added RedisSearchCtx_LockSpecRead/UnlockSpec around prepareExecutionPlan and QAST_DumpExplain, following the same pattern used in other callers. * Update comment
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.4 #8792 +/- ##
==========================================
- Coverage 85.54% 85.49% -0.05%
==========================================
Files 337 337
Lines 53417 53419 +2
Branches 11023 11023
==========================================
- Hits 45695 45670 -25
- Misses 7579 7606 +27
Partials 143 143
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|




Description
Backport of #8669 to 8.4.
Conflicts Resolved
src/aggregate/aggregate_exec.c: The 8.4 branch usesAREQ_Free()while master usesAREQ_DecrRef(). Resolved by keepingAREQ_Free()for the 8.4 branch while applying the locking fix (RedisSearchCtx_UnlockSpec).Jira
MOD-14624
Release Notes
User-impact: Before this fix, the DB may crash if running
FT.EXPLAINwhile GC updates the index.Pull Request opened by Augment Code with guidance from the PR author
Note
Medium Risk
Touches spec locking around
FT.EXPLAIN, a concurrency-sensitive area; while scoped, mistakes could cause deadlocks or leave locks held.Overview
Release note: Fixes a potential crash when running
FT.EXPLAINconcurrently with index GC/updates by taking a spec read lock while building the execution plan and generating the explain output.Written by Cursor Bugbot for commit d2d019e. This will update automatically on new commits. Configure here.