1996fanrui commented on code in PR #27861:
URL: https://github.com/apache/flink/pull/27861#discussion_r3030274177


##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/SingleInputGate.java:
##########
@@ -375,6 +375,19 @@ public void requestPartitions() {
         }
     }
 
+    /**
+     * Converts all {@link RecoveredInputChannel}s to their real channel types 
({@link
+     * LocalInputChannel} or {@link RemoteInputChannel}).
+     *
+     * <p><b>Lock ordering note:</b> This method acquires {@code 
inputChannelsWithData} and then may
+     * indirectly acquire {@code receivedBuffers} (via {@code 
toInputChannel()} and {@code
+     * releaseAllResources()}). This is the reverse order of {@link
+     * RecoveredInputChannel#onRecoveredStateBuffer}, which acquires {@code 
receivedBuffers} first
+     * and then {@code inputChannelsWithData} (via {@code 
notifyChannelNonEmpty()}). This is safe
+     * because {@code convertRecoveredInputChannels()} is only called from 
{@link
+     * #requestPartitions()}, which happens after all state recovery is 
complete (buffer filtering
+     * future is done), so {@code onRecoveredStateBuffer()} is no longer being 
called concurrently.

Review Comment:
   Good point. I've narrowed the inputChannelsWithData lock scope in 
`convertRecoveredInputChannels()` — moved `toInputChannel()`,  
`releaseAllResources()`, and `getBuffersInUseCount()` outside the synchronized 
block to eliminate the reverse lock ordering. The lock now only covers the data 
structure updates.



-- 
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]

Reply via email to