[CELEBORN-1866][Flink] Fix CelebornChannelBufferReader request more buffers than needed#3102
Closed
codenohup wants to merge 1 commit intoapache:mainfrom
Closed
[CELEBORN-1866][Flink] Fix CelebornChannelBufferReader request more buffers than needed#3102codenohup wants to merge 1 commit intoapache:mainfrom
codenohup wants to merge 1 commit intoapache:mainfrom
Conversation
SteNicholas
reviewed
Feb 17, 2025
...-1.20/src/main/java/org/apache/celeborn/plugin/flink/tiered/CelebornChannelBufferReader.java
Outdated
Show resolved
Hide resolved
55d4b44 to
c6b734d
Compare
SteNicholas
reviewed
Feb 17, 2025
...-1.20/src/main/java/org/apache/celeborn/plugin/flink/tiered/CelebornChannelBufferReader.java
Show resolved
Hide resolved
…uffers exceed than needed
c6b734d to
dc10454
Compare
SteNicholas
approved these changes
Feb 17, 2025
reswqa
approved these changes
Feb 19, 2025
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 changes were proposed in this pull request?
I found a case where a Flink job is hanging which utilize Celeborn hybrid integration strategy.
The issue seems to be that the CelebornChannelBufferReader is requesting more buffers than needed, which prevents other readers from getting enough buffers to continue reading data. This problem usually happens when memory competition is high.
When other readers recycle buffers back to the LocalBufferPool, the LocalBufferPool calls CelebornChannelBufferManager#notifyBufferAvailable to notify about the available buffer, and then CelebornChannelBufferManager requests buffers from the LocalBufferPool.
For instance, if CelebornBufferManager#numRequiredBuffers is set to 5 and it only gets 4 buffers from the LocalBufferPool, it won't immediately decrease numRequiredBuffers to 1. Instead, it will keep trying to request more buffers from the LocalBufferPool until it exits the synchronized block, at which point it will reduce numRequiredBuffers.
I think the bug occurs when the CelebornBufferManager exits the synchronized block. If a reader requests a buffer from this CelebornBufferManager, the number of buffers in BufferManager#bufferQueue _drops from 4 to 3. When the _LocalBufferPool has buffers again and tries to offer them to the CelebornBufferManager, the CelebornBufferManager mistakenly thinks it should request 2 buffers instead of just 1.
Why are the changes needed?
It may cause flink job hang.
Does this PR introduce any user-facing change?
no.
How was this patch tested?
We have a job that can reproduce this case. After the fix, it can be completed stably.