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

hellostephen 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 4f955c6e5ad [fix](be) Fix be aws-sdk-cpp memory leak (#52185)
4f955c6e5ad is described below

commit 4f955c6e5ad782609bf18c481e4190c531ede9a7
Author: Lei Zhang <[email protected]>
AuthorDate: Tue Jun 24 16:37:45 2025 +0800

    [fix](be) Fix be aws-sdk-cpp memory leak (#52185)
    
    * https://github.com/aws/aws-sdk-cpp/pull/2314
    * In the aws-sdk-cpp code, there is a suggestion: "Please call
    ShutdownAPI from the same thread from which InitAPI() has been called"
    otherwise it will cause memory leak.
    
    ```
    =================================================================
    ==3271527==ERROR: LeakSanitizer: detected memory leaks
    
    Direct leak of 216 byte(s) in 1 object(s) allocated from:
        #0 0x555f9ecf55ee in malloc 
(/mnt/ssd01/pipline/OpenSourceDoris/clusterEnv/P0/Cluster0/be/lib/doris_be+0x370815ee)
 (BuildId: 22b637395dd039b0)
        #1 0x555fd8e19bd7 in CRYPTO_zalloc 
(/mnt/ssd01/pipline/OpenSourceDoris/clusterEnv/P0/Cluster0/be/lib/doris_be+0x711a5bd7)
 (BuildId: 22b637395dd039b0)
        #2 0x555fda7c9d14 in aws_mqtt_library_init 
(/mnt/ssd01/pipline/OpenSourceDoris/clusterEnv/P0/Cluster0/be/lib/doris_be+0x72b55d14)
 (BuildId: 22b637395dd039b0)
        #3 0x555fda74ed1f in Aws::Crt::ApiHandle::ApiHandle(aws_allocator*) 
(/mnt/ssd01/pipline/OpenSourceDoris/clusterEnv/P0/Cluster0/be/lib/doris_be+0x72adad1f)
 (BuildId: 22b637395dd039b0)
        #4 0x555fa365f0c9 in doris::S3ClientFactory::instance() 
/root/doris/be/src/util/s3_util.cpp:188:28
        #5 0x555f9f13b87b in doris::io::ObjClientHolder::init() 
/root/doris/be/src/io/fs/s3_file_system.cpp:78:15
        #6 0x555f9f140eee in doris::io::S3FileSystem::init() 
/root/doris/be/src/io/fs/s3_file_system.cpp:182:21
        ......
    ```
---
 be/src/runtime/exec_env_init.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/be/src/runtime/exec_env_init.cpp b/be/src/runtime/exec_env_init.cpp
index 0aa82f90ddc..24cf6e99f79 100644
--- a/be/src/runtime/exec_env_init.cpp
+++ b/be/src/runtime/exec_env_init.cpp
@@ -376,6 +376,8 @@ Status ExecEnv::_init(const std::vector<StorePath>& 
store_paths,
     _dict_factory = new doris::vectorized::DictionaryFactory();
     _s_ready = true;
 
+    // Make aws-sdk-cpp InitAPI and ShutdownAPI called in the same thread
+    S3ClientFactory::instance();
     return Status::OK();
 }
 


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

Reply via email to