Copilot commented on code in PR #3720:
URL: https://github.com/apache/celeborn/pull/3720#discussion_r3375833911


##########
worker/src/main/java/org/apache/celeborn/service/deploy/worker/memory/MemoryManager.java:
##########
@@ -435,7 +435,8 @@ public void reserveSortMemory(long fileLen) {
 
   public boolean sortMemoryReady() {
     return maxSortMemory == 0
-        || (servingState == ServingState.NONE_PAUSED && 
sortMemoryCounter.get() < maxSortMemory);
+        || (servingState != ServingState.PUSH_AND_REPLICATE_PAUSED
+            && sortMemoryCounter.get() < maxSortMemory);
   }

Review Comment:
   sortMemoryReady() relies on the non-volatile `servingState` field, which is 
written by the scheduled checker thread (switchServingState()) and read by 
other threads such as PartitionFilesSorter. Without a happens-before edge, 
`sortMemoryReady()` may observe a stale state and continue returning true even 
after the worker transitions to PUSH_AND_REPLICATE_PAUSED, undermining the 
intent of blocking sorting under severe memory pressure.



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