Fix Fork GC potential double-free on error path - [MOD-12521]#7423
Merged
Fix Fork GC potential double-free on error path - [MOD-12521]#7423
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7423 +/- ##
==========================================
+ Coverage 84.82% 84.84% +0.01%
==========================================
Files 346 346
Lines 53426 53433 +7
Branches 14042 14042
==========================================
+ Hits 45321 45336 +15
+ Misses 7909 7901 -8
Partials 196 196
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:
|
2 tasks
413bed7 to
8e67ea8
Compare
da213b1 to
cef56a7
Compare
JoanFM
reviewed
Nov 20, 2025
eyalrund
reviewed
Nov 20, 2025
| } | ||
| if (temp_len == SIZE_MAX) { | ||
| *len = temp_len; | ||
| *buf = RECV_BUFFER_EMPTY; |
alonre24
approved these changes
Nov 20, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 20, 2025
* make FGC_recvBuffer clean * add revents to timeout log * improve polling logs * Nullify tag field name * remove unused variable * add a test * add a stres unit-test * improve test * improve logging * add include
Contributor
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 2.8
git worktree add -d .worktree/backport-7423-to-2.8 origin/2.8
cd .worktree/backport-7423-to-2.8
git switch --create backport-7423-to-2.8
git cherry-pick -x 442a75e07a6c285a13e938e768fdcef40ec1d5d4 |
Contributor
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 2.10
git worktree add -d .worktree/backport-7423-to-2.10 origin/2.10
cd .worktree/backport-7423-to-2.10
git switch --create backport-7423-to-2.10
git cherry-pick -x 442a75e07a6c285a13e938e768fdcef40ec1d5d4 |
redisearch-backport-pull-request bot
pushed a commit
that referenced
this pull request
Nov 21, 2025
* make FGC_recvBuffer clean * add revents to timeout log * improve polling logs * Nullify tag field name * remove unused variable * add a test * add a stres unit-test * improve test * improve logging * add include (cherry picked from commit 442a75e)
Contributor
|
Successfully created backport PR for |
redisearch-backport-pull-request bot
pushed a commit
that referenced
this pull request
Nov 21, 2025
* make FGC_recvBuffer clean * add revents to timeout log * improve polling logs * Nullify tag field name * remove unused variable * add a test * add a stres unit-test * improve test * improve logging * add include (cherry picked from commit 442a75e)
Contributor
|
Successfully created backport PR for |
GuyAv46
added a commit
that referenced
this pull request
Nov 21, 2025
* make FGC_recvBuffer clean * add revents to timeout log * improve polling logs * Nullify tag field name * remove unused variable * add a test * add a stres unit-test * improve test * improve logging * add include (cherry picked from commit 442a75e)
GuyAv46
added a commit
that referenced
this pull request
Nov 21, 2025
* make FGC_recvBuffer clean * add revents to timeout log * improve polling logs * Nullify tag field name * remove unused variable * add a test * add a stres unit-test * improve test * improve logging * add include (cherry picked from commit 442a75e)
This was referenced Nov 21, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 21, 2025
…7459) Fix Fork GC potential double-free on error path - [MOD-12521] (#7423) * make FGC_recvBuffer clean * add revents to timeout log * improve polling logs * Nullify tag field name * remove unused variable * add a test * add a stres unit-test * improve test * improve logging * add include (cherry picked from commit 442a75e) Co-authored-by: GuyAv46 <[email protected]>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 21, 2025
…7460) Fix Fork GC potential double-free on error path - [MOD-12521] (#7423) * make FGC_recvBuffer clean * add revents to timeout log * improve polling logs * Nullify tag field name * remove unused variable * add a test * add a stres unit-test * improve test * improve logging * add include (cherry picked from commit 442a75e) Co-authored-by: GuyAv46 <[email protected]>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 24, 2025
…7461) * Fix Fork GC potential double-free on error path - [MOD-12521] (#7423) * make FGC_recvBuffer clean * add revents to timeout log * improve polling logs * Nullify tag field name * remove unused variable * add a test * add a stres unit-test * improve test * improve logging * add include (cherry picked from commit 442a75e) * reuse one thread * improvement * remove harsh stress test * fix potential double close * exit from child with RedisModule_ExitFromChild * add heavy test back
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 24, 2025
…7462) * Fix Fork GC potential double-free on error path - [MOD-12521] (#7423) * make FGC_recvBuffer clean * add revents to timeout log * improve polling logs * Nullify tag field name * remove unused variable * add a test * add a stres unit-test * improve test * improve logging * add include (cherry picked from commit 442a75e) * remove harsh stress test * fix potential double close * exit from child with RedisModule_ExitFromChild * add heavy test back
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix polluting out-pointers on
FGC_recvBufferwhen error occursCurrently, if
FGC_recvBuffer, it may have set the out pointer even if it fails. This makes the memory management unclear, asFGC_recvBufferfrees the buffer it allocates, but if the caller sees that the out pointer is notNULL, it may attempt to free it as wellSolution: don't set the out parameters unless the call succeeds.
This PR also improves the log printed when polling from the child fails/times out.
Mark if applicable
Note
Strengthens Fork GC read/recv error paths with clearer logging and safer out-params, initializes pollfd, and adds tests that simulate pipe failures during GC/apply.
FGC_recvFixedpolling/error handling and add detailed log (incl.revents).FGC_recvBufferto use a temp length and set out-params only on success; fix potential double-free.gc->pollfd_readafter pipe creation; minor safety cleanups (e.g., initfieldName).testPipeErrorDuringGCandtestPipeErrorDuringApplyto simulate pipe closure/errors (including threaded timing) and verify graceful handling without crashes or double-frees.Written by Cursor Bugbot for commit cef56a7. This will update automatically on new commits. Configure here.