MOD-14850 Fix crash in race between MR_ClusterAsyncDisconnect and MR…#91
Merged
Conversation
…ClusterOnDisconnectCallback
Collaborator
Author
|
This pr also delete some temporary fix code which is not needed anymore(#51) |
galcohen-redislabs
approved these changes
Apr 20, 2026
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.
…_ClusterOnDisconnectCallback
Fix a race in
MR_ClusterAsyncDisconnect: a deferred disconnect task scheduled after a TLS handshake failure runs afterMR_ClusterOnDisconnectCallbackhas already nulledn->c, causingredisAsyncFree(NULL).Note
Medium Risk
Touches async connection lifecycle and TLS error handling, where subtle ordering issues can cause regressions; changes are small and covered by new race/TLS tests.
Overview
Prevents a crash when a deferred
MR_ClusterAsyncDisconnectruns after hiredis has already processed a disconnect and clearedn->c(common on TLS handshake failures) by guardingredisAsyncFreeand nulling the pointer after freeing.Cleans up the TLS connect failure path by removing a temporary hiredis callback-reset workaround, and extends the test suite with a targeted reproduction (
test_disconnect_race.py), TLS-capable shard mocks intest_network.py, and a single-node TLS test run in the test moduleMakefile.Reviewed by Cursor Bugbot for commit 5e13e85. Bugbot is set up for automated code reviews on this repo. Configure here.