yiguolei commented on code in PR #67755:
URL: https://github.com/apache/doris/pull/67755#discussion_r3975255534


##########
be/src/util/brpc_closure.h:
##########
@@ -118,9 +125,21 @@ class AutoReleaseClosure : public 
google::protobuf::Closure {
 
     ~AutoReleaseClosure() override = default;
 
-    // Will delete itself. all operations should be done in callback's call(). 
Run() only do one thing.
+    // Releases per-RPC resources, invokes the callback if it is still alive, 
and then deletes itself.
     void Run() override {
         Defer defer {[&]() { delete this; }};
+
+        // The request attachment is no longer needed after brpc finishes the 
RPC. It can contain a
+        // large serialized runtime filter, especially a Bloom filter. Since 
the callback owner may
+        // retain cntl_ after this closure is deleted (and some callbacks may 
also reuse it), keeping
+        // the attachment here would retain that memory until the next 
Controller::Reset() or until
+        // the callback is destroyed.
+        //
+        // This must be cleared before call(): a callback may synchronously 
start the next RPC and
+        // reuse the same Controller, in which case clearing it after call() 
could erase the new
+        // RPC's request attachment.
+        cntl_->request_attachment().clear();

Review Comment:
   In this case the query task will failed and we will make sure the objects 
will be deconstructed very quickly.



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