This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 2e183187 fix h2 rpc_dump mem leak bug (#2661)
2e183187 is described below

commit 2e183187bcbccc39c7da8dde2a98d02a7a031279
Author: yanghongchao <[email protected]>
AuthorDate: Thu Jun 13 12:27:19 2024 +0800

    fix h2 rpc_dump mem leak bug (#2661)
---
 src/brpc/policy/http_rpc_protocol.cpp | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/brpc/policy/http_rpc_protocol.cpp 
b/src/brpc/policy/http_rpc_protocol.cpp
index 2587cf3f..52fff2c9 100644
--- a/src/brpc/policy/http_rpc_protocol.cpp
+++ b/src/brpc/policy/http_rpc_protocol.cpp
@@ -1578,15 +1578,17 @@ void ProcessHttpRequest(InputMessageBase *msg) {
                 }
             }
         }
-        SampledRequest* sample = AskToBeSampled();
-        if (sample && !is_http2) {
-            sample->meta.set_compress_type(COMPRESS_TYPE_NONE);
-            sample->meta.set_protocol_type(PROTOCOL_HTTP);
-            sample->meta.set_attachment_size(req_body.size());
-
-            butil::EndPoint ep;
-            MakeRawHttpRequest(&sample->request, &req_header, ep, &req_body);
-            sample->submit(start_parse_us);
+        if (!is_http2) {
+            SampledRequest* sample = AskToBeSampled();
+            if (sample) {
+                sample->meta.set_compress_type(COMPRESS_TYPE_NONE);
+                sample->meta.set_protocol_type(PROTOCOL_HTTP);
+                sample->meta.set_attachment_size(req_body.size());
+
+                butil::EndPoint ep;
+                MakeRawHttpRequest(&sample->request, &req_header, ep, 
&req_body);
+                sample->submit(start_parse_us);
+            }
         }
     } else {
         if (imsg_guard->read_body_progressively()) {


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

Reply via email to