Skip to content

[8.2] [MOD-15685] Fix crash when a legacy index spec is restored on a running server - #11616

Merged
redisearch-backport-pull-request[bot] merged 1 commit into
8.2from
backport-agent/pr-10872-to-8.2
Sep 29, 2026
Merged

redisearch-backport-pull-request[bot] merged 1 commit into
8.2from
backport-agent/pr-10872-to-8.2

Conversation

@redisearch-backport-pull-request

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

Copy link
Copy Markdown
Contributor

Backport of #10872 to 8.2.

Original PR

Cherry-pick result

  • Resolved 2 conflict(s) — see Conflict Log below.

Conflict Log

src/spec.c

  • Conflict: The incoming hunk includes the new null-dictionary guard next to a SearchDisk_IsEnabled assertion; the release branch has no such assertion at this location.
  • Why it conflicted: 8.2 retains the legacy loader without the disk-mode assertion present in the source commit context. Both legacy dictionaries and their load-time lifecycle are present on this branch.
  • Resolution: Inserted the original guard and explanatory comment immediately after the encoding-version check and before the first payload read. Omitted the disk-mode assertion from the conflicting context, preserving the release loader otherwise unchanged.
  • Rationale: Rejects legacy RESTORE payloads when either dictionary is absent while preserving genuine RDB upgrades. The guard is identical to the original commit; no disk-mode behavior is introduced. Static diff and commit-provenance checks passed; builds and tests were not run, as requested.

tests/pytests/test_legacy_module_types.py

  • Conflict: The source commit appends a regression test to a file absent on 8.2, producing a modify/delete conflict.
  • Why it conflicted: The 8.2 base does not contain the earlier legacy-module persistence test file or its payload-construction helpers.
  • Resolution: Created the file with the original RESTORE-refusal regression test and the imports, constants, binary connection, CRC, length encoding, module type, and payload helpers it needs. Excluded the unrelated legacy round-trip and helper tests, their unused legacy-body helper, and comments describing those tests.
  • Rationale: Preserves the PR regression assertions for encoding versions 2, 9, and 16 without importing older persistence behavior or unrelated tests. Required helpers were carried over from the source file. Runtime validation remains for backport CI.

Release notes

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

🤖 Generated by the auto-backport workflow.

…ng server (#10872)

[MOD-15685] Refuse a legacy index spec RESTORE outside an RDB load

A legacy index spec can only be upgraded while a load is in progress: both the
UPGRADE_INDEX rules and the registry of legacy specs are built for the duration of
a load and released at the end of it. IndexSpec_LegacyRdbLoad then looks both up
unconditionally, so restoring a legacy ft_index0 payload on a running server
reached dictFetchValue on a NULL dict and segfaulted. Any client holding RESTORE
could do it.

Refuse when either global is absent. The caller sees a load failure, which for
RESTORE surfaces as a command error rather than a dead server. The check sits
before anything is read, so a crafted payload needs no valid body to be rejected.

Verified by removing the guard again: the server dies with the test reporting
connection refused, so the test fails when the bug is present rather than passing
for the wrong reason.

This is MOD-15685 finding #71; #29 was fixed in #10817.

Co-authored-by: Claude Opus 5 <[email protected]>
(cherry picked from commit 1d4c089)
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.09%. Comparing base (17cd453) to head (180e658).

Additional details and impacted files
@@            Coverage Diff             @@
##              8.2   #11616      +/-   ##
==========================================
- Coverage   89.09%   89.09%   -0.01%     
==========================================
  Files         262      262              
  Lines       43225    43228       +3     
  Branches     3851     3851              
==========================================
+ Hits        38510    38512       +2     
- Misses       4666     4667       +1     
  Partials       49       49              
Flag Coverage Δ
flow 82.05% <100.00%> (-0.12%) ⬇️
unit 47.30% <0.00%> (+<0.01%) ⬆️

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.

@redisearch-backport-pull-request
redisearch-backport-pull-request Bot added this pull request to the merge queue Sep 29, 2026
@sonarqubecloud

Copy link
Copy Markdown

Merged via the queue into 8.2 with commit 5bcc635 Sep 29, 2026
48 checks passed
@redisearch-backport-pull-request
redisearch-backport-pull-request Bot deleted the backport-agent/pr-10872-to-8.2 branch September 29, 2026 14:37
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 auto-backport-conflicts There were conflicts in this automatic backport size:M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant