[CELEBORN-2274] Fix replicate channels not resumed when transitioning from PUSH_AND_REPLICATE_PAUSED to PUSH_PAUSED#3616
Open
sl3635 wants to merge 1 commit intoapache:mainfrom
Open
[CELEBORN-2274] Fix replicate channels not resumed when transitioning from PUSH_AND_REPLICATE_PAUSED to PUSH_PAUSED#3616sl3635 wants to merge 1 commit intoapache:mainfrom
sl3635 wants to merge 1 commit intoapache:mainfrom
Conversation
… from PUSH_AND_REPLICATE_PAUSED to PUSH_PAUSED
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?
Fix a bug in
MemoryManager.switchServingState()where replicate channels permanently loseautoRead=trueafter a memory pressure event.When the serving state transitions from
PUSH_AND_REPLICATE_PAUSEDtoPUSH_PAUSED,resumeReplicate()was only called inside the!tryResumeByPinnedMemory()guard. IftryResumeByPinnedMemory()returnedtrue, the entire block was skipped and replicate channels were never resumed.The fix moves
resumeReplicate()outside thetryResumeByPinnedMemory()guard so it is always called when stepping down fromPUSH_AND_REPLICATE_PAUSEDtoPUSH_PAUSED. This is a state machine invariant:PUSH_PAUSEDmeans only push is paused; replicate must always be resumed.Why are the changes needed?
Once replicate channels are stuck with
autoRead=false, Netty I/O threads stop reading from all replicate connections. Remote workers writing to the affected worker see their TCP send buffers fill up (zero window), causing pending writes to accumulate inChannelOutboundBuffer. Each pending write holds a reference to a direct memoryByteBuf, causing direct memory to grow indefinitely on the remote workers.The failure sequence:
PUSH_AND_REPLICATE_PAUSED→ all channels pausedtryResumeByPinnedMemory()returnstrue→resumeByPinnedMemory(PUSH_PAUSED)resumes push only, replicate not resumedPUSH_PAUSED, butresumeReplicate()is never calledautoRead=false, causing unbounded direct memory growth on remote workersDoes this PR resolve a correctness bug?
Yes.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Added a new unit test
Test MemoryManager resume replicate by pinned memoryinMemoryManagerSuitethat reproduces the exact failure scenario:PUSH_AND_REPLICATE_PAUSEDwith low pinned memory (channels resumed by pinned memory path)PUSH_PAUSEDrange with low pinned memory