[FLINK-24035][network] Notify the buffer listeners when the local buffer pool receives available notification from the global pool#17030
Closed
wsry wants to merge 4 commits intoapache:masterfrom
Closed
[FLINK-24035][network] Notify the buffer listeners when the local buffer pool receives available notification from the global pool#17030wsry wants to merge 4 commits intoapache:masterfrom
wsry wants to merge 4 commits intoapache:masterfrom
Conversation
added 3 commits
August 27, 2021 19:42
… help debugging when the case is stuck This closes apache#17009.
…otified when recycling buffers Previously, the buffer listener will be removed from the listener queue when notified and then it will be added to the listener queue again if it needs more buffers. However, if some buffers are recycled meanwhile, the buffer listener will not be notified of the available buffers. For example: 1. Thread 1 calls LocalBufferPool#recycle(). 2. Thread 1 reaches LocalBufferPool#fireBufferAvailableNotification() and listener.notifyBufferAvailable() is invoked, but Thread 1 sleeps before acquiring the lock to registeredListeners.add(listener). 3. Thread 2 is being woken up as a result of notifyBufferAvailable() call. It takes the buffer, but it needs more buffers. 4. Other threads, return all buffers, including this one that has been recycled. None are taken. Are all in the LocalBufferPool. 5. Thread 1 wakes up, and continues fireBufferAvailableNotification() invocation. 6. Thread 1 re-adds listener that's waiting for more buffer registeredListeners.add(listener). 7. Thread 1 exits loop LocalBufferPool#recycle(MemorySegment, int) inside, as the original memory segment has been used. At the end we have a state where all buffers are in the LocalBufferPool, so no new recycle() calls will happen, but there is still one listener waiting for a buffer (despite buffers being available). This change fixes the issue by letting the buffer listener request multiple buffers one after another without having to enqueue BufferListener to the registeredListener queue. This closes apache#17009.
…fy the code This closes apache#17009.
Collaborator
|
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit f096231 (Sat Aug 28 13:11:25 UTC 2021) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. DetailsThe Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
Contributor
Author
|
This fix is still under testing. |
…fer pool receives available notification from the global pool Previously, The buffer listeners are not notified when the the local buffer pool receives available notification from the global pool. This may cause potential deadlock issue: 1. A LocalBufferPool is created but there is no available buffers in the global NetworkBufferPool. 2. The LocalBufferPool registers an available buffer listener to the global NetworkBufferPool. 3. The BufferManager requests buffers from the LocalBufferPool but no buffer is available. As a result, it registers an available buffer listener to the LocalBufferPool. 4. A buffer is recycled to the global NetworkBufferPool and the LocalBufferPool is notified about the available buffer. 5. The LocalBufferPool requests the available buffer from the global NetworkBufferPool but the registered available buffer listener of BufferManager is not notified and it can never get a chance to be notified so deadlock occurs. This patch fixes this issue by notifying the buffer listeners when the local buffer pool receives available notification from the global pool.
Contributor
Author
|
@flinkbot run azure |
1 similar comment
Contributor
Author
|
@flinkbot run azure |
Contributor
Author
|
Abandoned. |
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
Brief change log
Verifying this change
This change added tests.
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (yes / no)Documentation