[FLINK-40525][network] Remove residual receivedBuffers lock in finishReadRecoveredState to avoid ABBA deadlock - #29053
Open
1996fanrui wants to merge 1 commit into
Open
[FLINK-40525][network] Remove residual receivedBuffers lock in finishReadRecoveredState to avoid ABBA deadlock#290531996fanrui wants to merge 1 commit into
1996fanrui wants to merge 1 commit into
Conversation
…ReadRecoveredState to avoid ABBA deadlock finishReadRecoveredState() wrapped onRecoveredStateBuffer() in synchronized(receivedBuffers), but that method already locks receivedBuffers internally and, when the queue was empty, calls notifyChannelNonEmpty(), which acquires inputChannelsWithData while receivedBuffers is still held. This inverts the task thread's inputChannelsWithData -> receivedBuffers lock order and can deadlock on the error path (ABBA). Removing the redundant outer lock restores the correct order with no behavior change, since onRecoveredStateBuffer already provides the required mutual exclusion.
Collaborator
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.
What is the purpose of the change
RecoveredInputChannel.finishReadRecoveredState()wrappedonRecoveredStateBuffer()insynchronized(receivedBuffers), but that method already locksreceivedBuffersinternally and, when thequeue was empty, calls
notifyChannelNonEmpty(), which acquiresinputChannelsWithDatawhilereceivedBuffersis still held. This inverts the task thread'sinputChannelsWithData -> receivedBufferslock order and can deadlock on the error path (ABBA). Removing the redundant outer lock restores the correct
order with no behavior change, since
onRecoveredStateBufferalready provides the required mutual exclusion.Brief change log
synchronized(receivedBuffers)inRecoveredInputChannel.finishReadRecoveredState().Verifying this change
This change is a trivial rework / code cleanup without any test coverage. The ABBA cycle is an error-path
lock-ordering issue that cannot be reproduced deterministically in a unit test;
onRecoveredStateBufferretains its internal locking, so behavior is otherwise unchanged.
Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?