Skip to content

[MOD-11011] Fix deadlock while RDB loading and RM_Yield#6763

Merged
JoanFM merged 15 commits intomasterfrom
fix-rdb-load-lock
Sep 4, 2025
Merged

[MOD-11011] Fix deadlock while RDB loading and RM_Yield#6763
JoanFM merged 15 commits intomasterfrom
fix-rdb-load-lock

Conversation

@JoanFM
Copy link
Copy Markdown
Collaborator

@JoanFM JoanFM commented Sep 2, 2025

Describe the changes in the pull request

This PR aims to solve the issue identified in MOD-11011.

The issue is that RediSearch Yields control to RedisCore while keeping the Write Lock for an Index Spec Lock. During that time, INFO commands may be processed which may take Read Lock of the same lock. In this case, the Read Lock may fail, but since we are still releasing the lock, we enter in the undefined behavior scene and scenarios where the server is locked while trying to acquire again the Write Lock appear.

@github-actions github-actions bot added the size:M label Sep 2, 2025
@JoanFM JoanFM added enforce:coverage Run coverage flow even on draft pull request enforce:sanitize Run sanitizer flow even on draft pull request enforce:test Run the test suite even if no code has changed. labels Sep 2, 2025
@JoanFM JoanFM closed this Sep 2, 2025
@JoanFM JoanFM reopened this Sep 2, 2025
@JoanFM JoanFM requested review from BenGoldberger, alonre24 and meiravgri and removed request for meiravgri September 2, 2025 16:04
@JoanFM JoanFM marked this pull request as ready for review September 2, 2025 16:05
@JoanFM JoanFM marked this pull request as draft September 2, 2025 16:21
@JoanFM JoanFM marked this pull request as ready for review September 2, 2025 16:37
@github-actions github-actions bot added the size:S label Sep 3, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 86.84211% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.21%. Comparing base (e10a8e7) to head (3ac60d9).
⚠️ Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
src/debug_commands.c 76.92% 3 Missing ⚠️
src/info/indexes_info.c 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6763      +/-   ##
==========================================
- Coverage   87.29%   87.21%   -0.09%     
==========================================
  Files         287      287              
  Lines       45226    45271      +45     
  Branches     8073     8238     +165     
==========================================
+ Hits        39482    39483       +1     
- Misses       5621     5663      +42     
- Partials      123      125       +2     
Flag Coverage Δ
flow 84.68% <86.84%> (+<0.01%) ⬆️
unit 49.25% <36.84%> (-0.08%) ⬇️

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.

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 3, 2025
@JoanFM JoanFM added this pull request to the merge queue Sep 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 3, 2025
@JoanFM JoanFM added this pull request to the merge queue Sep 4, 2025
@JoanFM JoanFM removed this pull request from the merge queue due to a manual request Sep 4, 2025
@JoanFM JoanFM added this pull request to the merge queue Sep 4, 2025
@JoanFM JoanFM removed this pull request from the merge queue due to a manual request Sep 4, 2025
@JoanFM JoanFM added this pull request to the merge queue Sep 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 4, 2025
@JoanFM JoanFM added this pull request to the merge queue Sep 4, 2025
@JoanFM JoanFM removed this pull request from the merge queue due to a manual request Sep 4, 2025
@JoanFM JoanFM added this pull request to the merge queue Sep 4, 2025
Merged via the queue into master with commit 4710f44 Sep 4, 2025
40 checks passed
@JoanFM JoanFM deleted the fix-rdb-load-lock branch September 4, 2025 18:56
@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

Backport failed for 2.8, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.8
git worktree add -d .worktree/backport-6763-to-2.8 origin/2.8
cd .worktree/backport-6763-to-2.8
git switch --create backport-6763-to-2.8
git cherry-pick -x 4710f44833d649d44a78b1095677ccdb918b00fa

@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

Backport failed for 2.6, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.6
git worktree add -d .worktree/backport-6763-to-2.6 origin/2.6
cd .worktree/backport-6763-to-2.6
git switch --create backport-6763-to-2.6
git cherry-pick -x 4710f44833d649d44a78b1095677ccdb918b00fa

@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

Backport failed for 2.10, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.10
git worktree add -d .worktree/backport-6763-to-2.10 origin/2.10
cd .worktree/backport-6763-to-2.10
git switch --create backport-6763-to-2.10
git cherry-pick -x 4710f44833d649d44a78b1095677ccdb918b00fa

@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

Backport failed for 8.0, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 8.0
git worktree add -d .worktree/backport-6763-to-8.0 origin/8.0
cd .worktree/backport-6763-to-8.0
git switch --create backport-6763-to-8.0
git cherry-pick -x 4710f44833d649d44a78b1095677ccdb918b00fa

@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

Backport failed for 8.2, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 8.2
git worktree add -d .worktree/backport-6763-to-8.2 origin/8.2
cd .worktree/backport-6763-to-8.2
git switch --create backport-6763-to-8.2
git cherry-pick -x 4710f44833d649d44a78b1095677ccdb918b00fa

JoanFM added a commit that referenced this pull request Sep 5, 2025
* add test file trying to reproduce lock

* test RDB update

* try the test changes

* only keep test changes

* remove some logs

* fix: Yield to Redis before acquiring Write Lock

* proper Lock initialization on RDB load

* proper initialization

* remove test file

* remove comment from code

* add numOps instead of reducing Yield frequency

* move lock init

* add DEBUG command to improve testing

* fix failing tests

* remove added tests by mistake

(cherry picked from commit 4710f44)
JoanFM added a commit that referenced this pull request Sep 5, 2025
* add test file trying to reproduce lock

* test RDB update

* try the test changes

* only keep test changes

* remove some logs

* fix: Yield to Redis before acquiring Write Lock

* proper Lock initialization on RDB load

* proper initialization

* remove test file

* remove comment from code

* add numOps instead of reducing Yield frequency

* move lock init

* add DEBUG command to improve testing

* fix failing tests

* remove added tests by mistake

(cherry picked from commit 4710f44)
JoanFM added a commit that referenced this pull request Sep 5, 2025
* add test file trying to reproduce lock

* test RDB update

* try the test changes

* only keep test changes

* remove some logs

* fix: Yield to Redis before acquiring Write Lock

* proper Lock initialization on RDB load

* proper initialization

* remove test file

* remove comment from code

* add numOps instead of reducing Yield frequency

* move lock init

* add DEBUG command to improve testing

* fix failing tests

* remove added tests by mistake

(cherry picked from commit 4710f44)
JoanFM added a commit that referenced this pull request Sep 5, 2025
* add test file trying to reproduce lock

* test RDB update

* try the test changes

* only keep test changes

* remove some logs

* fix: Yield to Redis before acquiring Write Lock

* proper Lock initialization on RDB load

* proper initialization

* remove test file

* remove comment from code

* add numOps instead of reducing Yield frequency

* move lock init

* add DEBUG command to improve testing

* fix failing tests

* remove added tests by mistake

(cherry picked from commit 4710f44)
github-merge-queue bot pushed a commit that referenced this pull request Sep 7, 2025
…#6787)

[MOD-11011] Fix deadlock while RDB loading and RM_Yield (#6763)

* add test file trying to reproduce lock

* test RDB update

* try the test changes

* only keep test changes

* remove some logs

* fix: Yield to Redis before acquiring Write Lock

* proper Lock initialization on RDB load

* proper initialization

* remove test file

* remove comment from code

* add numOps instead of reducing Yield frequency

* move lock init

* add DEBUG command to improve testing

* fix failing tests

* remove added tests by mistake

(cherry picked from commit 4710f44)
github-merge-queue bot pushed a commit that referenced this pull request Sep 7, 2025
…#6784)

* [MOD-11011] Fix deadlock while RDB loading and RM_Yield (#6763)

* add test file trying to reproduce lock

* test RDB update

* try the test changes

* only keep test changes

* remove some logs

* fix: Yield to Redis before acquiring Write Lock

* proper Lock initialization on RDB load

* proper initialization

* remove test file

* remove comment from code

* add numOps instead of reducing Yield frequency

* move lock init

* add DEBUG command to improve testing

* fix failing tests

* remove added tests by mistake

(cherry picked from commit 4710f44)

* fix merging

* fix merging issues

* fix merging issues

* fix compilation

* fix compilation

* do not print index name

* add missing func

* fix pytest

* fix: name of config set command

* fix debug command parsing
github-merge-queue bot pushed a commit that referenced this pull request Sep 7, 2025
#6785)

* [MOD-11011] Fix deadlock while RDB loading and RM_Yield (#6763)

* add test file trying to reproduce lock

* test RDB update

* try the test changes

* only keep test changes

* remove some logs

* fix: Yield to Redis before acquiring Write Lock

* proper Lock initialization on RDB load

* proper initialization

* remove test file

* remove comment from code

* add numOps instead of reducing Yield frequency

* move lock init

* add DEBUG command to improve testing

* fix failing tests

* remove added tests by mistake

(cherry picked from commit 4710f44)

* fix compilation

* do not print index name

* add missing func

* fix pytest

* fix: remove not-needed pytest file

* remove invalid option
nafraf added a commit that referenced this pull request Sep 27, 2025
nafraf added a commit that referenced this pull request Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 2.6 backport 2.8 backport 2.10 backport 8.2 enforce:coverage Run coverage flow even on draft pull request enforce:sanitize Run sanitizer flow even on draft pull request enforce:test Run the test suite even if no code has changed. size:M size:S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants