wsry commented on a change in pull request #11877:
URL: https://github.com/apache/flink/pull/11877#discussion_r662010444
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/BufferManager.java
##########
@@ -215,9 +221,15 @@ public void recycle(MemorySegment segment) {
}
void releaseFloatingBuffers() {
+ Queue<Buffer> buffers;
synchronized (bufferQueue) {
numRequiredBuffers = 0;
- bufferQueue.releaseFloatingBuffers();
+ buffers = bufferQueue.clearFloatingBuffers();
+ }
+
+ // recycle all buffers out of the synchronization block to avoid dead
lock
Review comment:
Each RemoteInputChannel has its own BufferManager and bufferQueue,
floating buffers recycled by one RemoteInputChannel can be assigned to other
RemoteInputChannels directly and the buffer assignment also need to sync the
bufferQueue object. Besides, different RemoteInputChannels may recycle buffers
simultaneously, which means we may need to lock two bufferQueue objects of
different RemoteInputChannels simultaneously in the reverse order. I already
encountered this dead lock when running test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]