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

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


The following commit(s) were added to refs/heads/master by this push:
     new a18615c0ae6 [Bug](http-api) fix core dump on API check_rpc_channel coz 
exec_env not init (#39520)
a18615c0ae6 is described below

commit a18615c0ae69a852a3e8148f3fa42e868d300f74
Author: Vallish Pai <vallish...@gmail.com>
AuthorDate: Tue Aug 20 07:42:58 2024 +0530

    [Bug](http-api) fix core dump on API check_rpc_channel coz exec_env not 
init (#39520)
    
    ## Proposed changes
    
    Issue Number: close #39519
    
    Initialised the exec_env in code and verified again. no crash
    
    [root@vallish-ThinkPad-T14s-Gen-2i doris]# !curl
    **curl
    http://127.0.0.1:8040/api/check_rpc_channel/127.0.0.1/8060/1024000
    open brpc connection to 127.0.0.1:8060 success.**
---
 be/src/http/action/check_rpc_channel_action.cpp    |  1 +
 be/src/http/action/check_rpc_channel_action.h      |  3 ---
 be/src/http/action/reset_rpc_channel_action.cpp    |  3 ++-
 be/src/http/action/reset_rpc_channel_action.h      |  3 ---
 be/src/http/http_handler_with_auth.h               |  4 ++-
 .../org/apache/doris/regression/suite/Suite.groovy | 13 +++++++++
 .../check_rpc_channel/check_rpc_channel.groovy     | 31 ++++++++--------------
 7 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/be/src/http/action/check_rpc_channel_action.cpp 
b/be/src/http/action/check_rpc_channel_action.cpp
index 4949b21b8f5..7b98db510e5 100644
--- a/be/src/http/action/check_rpc_channel_action.cpp
+++ b/be/src/http/action/check_rpc_channel_action.cpp
@@ -39,6 +39,7 @@ namespace doris {
 CheckRPCChannelAction::CheckRPCChannelAction(ExecEnv* exec_env, 
TPrivilegeHier::type hier,
                                              TPrivilegeType::type type)
         : HttpHandlerWithAuth(exec_env, hier, type) {}
+
 void CheckRPCChannelAction::handle(HttpRequest* req) {
     std::string req_ip = req->param("ip");
     std::string req_port = req->param("port");
diff --git a/be/src/http/action/check_rpc_channel_action.h 
b/be/src/http/action/check_rpc_channel_action.h
index 883180f02df..07969c80f08 100644
--- a/be/src/http/action/check_rpc_channel_action.h
+++ b/be/src/http/action/check_rpc_channel_action.h
@@ -31,8 +31,5 @@ public:
     ~CheckRPCChannelAction() override = default;
 
     void handle(HttpRequest* req) override;
-
-private:
-    ExecEnv* _exec_env;
 };
 } // namespace doris
diff --git a/be/src/http/action/reset_rpc_channel_action.cpp 
b/be/src/http/action/reset_rpc_channel_action.cpp
index b14c0f65e7f..a9aa6ec950e 100644
--- a/be/src/http/action/reset_rpc_channel_action.cpp
+++ b/be/src/http/action/reset_rpc_channel_action.cpp
@@ -34,7 +34,8 @@
 namespace doris {
 ResetRPCChannelAction::ResetRPCChannelAction(ExecEnv* exec_env, 
TPrivilegeHier::type hier,
                                              TPrivilegeType::type type)
-        : HttpHandlerWithAuth(exec_env, hier, type), _exec_env(exec_env) {}
+        : HttpHandlerWithAuth(exec_env, hier, type) {}
+
 void ResetRPCChannelAction::handle(HttpRequest* req) {
     std::string endpoints = req->param("endpoints");
     if (iequal(endpoints, "all")) {
diff --git a/be/src/http/action/reset_rpc_channel_action.h 
b/be/src/http/action/reset_rpc_channel_action.h
index 16efecfee26..ba13c6be7c6 100644
--- a/be/src/http/action/reset_rpc_channel_action.h
+++ b/be/src/http/action/reset_rpc_channel_action.h
@@ -31,8 +31,5 @@ public:
     ~ResetRPCChannelAction() override = default;
 
     void handle(HttpRequest* req) override;
-
-private:
-    ExecEnv* _exec_env;
 };
 } // namespace doris
diff --git a/be/src/http/http_handler_with_auth.h 
b/be/src/http/http_handler_with_auth.h
index 178971560c0..894a3a81e50 100644
--- a/be/src/http/http_handler_with_auth.h
+++ b/be/src/http/http_handler_with_auth.h
@@ -51,8 +51,10 @@ public:
         return true;
     }
 
-private:
+protected:
     ExecEnv* _exec_env;
+
+private:
     TPrivilegeHier::type _hier;
     TPrivilegeType::type _type;
 };
diff --git 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
index 33496257c17..ac8795729e1 100644
--- 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
+++ 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
@@ -939,6 +939,19 @@ class Suite implements GroovyInterceptable {
         return;
     }
 
+    void getBackendIpHttpAndBrpcPort(Map<String, String> 
backendId_to_backendIP,
+        Map<String, String> backendId_to_backendHttpPort, Map<String, String> 
backendId_to_backendBrpcPort) {
+
+        List<List<Object>> backends = sql("show backends");
+        for (List<Object> backend : backends) {
+            backendId_to_backendIP.put(String.valueOf(backend[0]), 
String.valueOf(backend[1]));
+            backendId_to_backendHttpPort.put(String.valueOf(backend[0]), 
String.valueOf(backend[4]));
+            backendId_to_backendBrpcPort.put(String.valueOf(backend[0]), 
String.valueOf(backend[5]));
+        }
+        return;
+    }
+
+
     int getTotalLine(String filePath) {
         def file = new File(filePath)
         int lines = 0;
diff --git a/be/src/http/action/check_rpc_channel_action.h 
b/regression-test/suites/http_p0/check_rpc_channel/check_rpc_channel.groovy
similarity index 55%
copy from be/src/http/action/check_rpc_channel_action.h
copy to 
regression-test/suites/http_p0/check_rpc_channel/check_rpc_channel.groovy
index 883180f02df..d79f71dac5c 100644
--- a/be/src/http/action/check_rpc_channel_action.h
+++ b/regression-test/suites/http_p0/check_rpc_channel/check_rpc_channel.groovy
@@ -1,3 +1,4 @@
+
 // Licensed to the Apache Software Foundation (ASF) under one
 // or more contributor license agreements.  See the NOTICE file
 // distributed with this work for additional information
@@ -15,24 +16,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#pragma once
-
-#include "http/http_handler_with_auth.h"
-
-namespace doris {
-class ExecEnv;
-class HttpRequest;
-
-class CheckRPCChannelAction : public HttpHandlerWithAuth {
-public:
-    explicit CheckRPCChannelAction(ExecEnv* exec_env, TPrivilegeHier::type 
hier,
-                                   TPrivilegeType::type type);
-
-    ~CheckRPCChannelAction() override = default;
-
-    void handle(HttpRequest* req) override;
+suite('check_rpc_channel') {
+    def backendId_to_backendIP = [:]
+    def backendId_to_backendHttpPort = [:]
+    def backendId_to_backendBrpcPort = [:]    
 
-private:
-    ExecEnv* _exec_env;
-};
-} // namespace doris
+    getBackendIpHttpAndBrpcPort(backendId_to_backendIP, 
backendId_to_backendHttpPort, backendId_to_backendBrpcPort);
+    for (int i=0;i<backendId_to_backendIP.size();i++){
+        def beHttpAddress 
=backendId_to_backendIP.entrySet()[i].getValue()+":"+backendId_to_backendHttpPort.entrySet()[i].getValue()
+        
curl("POST",beHttpAddress+"/api/check_rpc_channel/"+backendId_to_backendIP.entrySet()[i].getValue()+"/"+backendId_to_backendBrpcPort.entrySet()[i].getValue()+"/1024000")
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to