boneanxs commented on code in PR #12919:
URL: https://github.com/apache/gluten/pull/12919#discussion_r3975098607


##########
cpp/velox/memory/GlutenDirectBufferedInput.h:
##########
@@ -66,11 +118,28 @@ class GlutenDirectBufferedInput : public 
facebook::velox::dwio::common::DirectBu
       }
     }
     coalescedLoads_.clear();
+    // The cancelled loads above are still referenced by the AsyncLoadHolder
+    // closures queued on the executor, and those closures hold a shared_ptr on
+    // the memory pool. Wait until the executor has run and destroyed them so
+    // that the pool reference is released before this destructor returns,
+    // instead of on an IO thread after the task and its memory manager are
+    // gone.
+    if (barrier() != nullptr) {
+      try {
+        barrier()->waitAll();

Review Comment:
   The task will keep waiting, will there be any issue like the task hangs 
there forever?
   
   I'm curious why don't we let the memoryManager destructed quietly when the 
executor is going to terminated, seems it's harmless from Spark side 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to