zhijiangW commented on a change in pull request #11351: [FLINK-16404][runtime] 
Solve the potential deadlock problem when reducing exclusive buffers to zero
URL: https://github.com/apache/flink/pull/11351#discussion_r396269643
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java
 ##########
 @@ -416,7 +452,18 @@ public int getUnannouncedCredit() {
         * @return Credit which was not announced to the sender yet.
         */
        public int getAndResetUnannouncedCredit() {
-               return unannouncedCredit.getAndSet(0);
+               synchronized (bufferQueue) {
+                       int credit = unannouncedCredit;
+                       unannouncedCredit = 0;
+                       if (credit == 0) {
 
 Review comment:
   It is tricky to make zero credit has a special meaning, and we also break 
the previous assumption without negative credits. 
   
   I think it might be better to define a separate message to describe the 
semantic of barrier alignment to unblock upstream side. Then the credit is 
always positive to be consistent as before, and we only define another blocked 
state on upstream side to control the buffer transport besides with positive 
credits. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to