[ 
https://issues.apache.org/jira/browse/IMPALA-11176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17507982#comment-17507982
 ] 

ASF subversion and git services commented on IMPALA-11176:
----------------------------------------------------------

Commit 9149345f1ffc216e134f68461ea4a646ccdf5fb4 in impala's branch 
refs/heads/master from Yida Wu
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=9149345 ]

IMPALA-11176: Fix Memory leak in ClientCacheHelper

The patch fixes a memory leak issue in client cache.

The memory leak happens because a shared pointer of the
base class "ThriftClientImpl" is created from a derived class
"ThriftClient" while the base class's destructor is non-virtual.
As a result, the shared pointer can't locate the correct
destructor, which should be the derived one, and leads to
memory leaks.

The way to fix in the patch is to make the destructor of
"ThriftClientImpl" virtual. Added testcase ClientCacheTest.

Tests:
Ran exhaustive tests.

Change-Id: I2bf3d7e7d897c89eb4538df5382ce3c590055b71
Reviewed-on: http://gerrit.cloudera.org:8080/18314
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> Memory leak in ClientCacheHelper
> --------------------------------
>
>                 Key: IMPALA-11176
>                 URL: https://issues.apache.org/jira/browse/IMPALA-11176
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend
>    Affects Versions: Impala 4.0.0, Impala 3.4.0
>            Reporter: Yida Wu
>            Assignee: Yida Wu
>            Priority: Critical
>             Fix For: Impala 4.1.0
>
>
> ClientCacheHelper::CreateClient uses a function pointer "factory_method" to 
> create a new ThriftClientImpl object and store it in a share pointer of type 
> ThriftClientImpl.
> However, in the implementation of the function pointer, which uses 
> ClientCache::MakeClient, it creates a derived object of ThriftClientImpl and 
> return the pointer as the base object pointer ThriftClientImpl*. When the 
> ClientCacheHelper::CreateClient uses the returned pointer to create a base 
> shared pointer, it can't recognize that the pointer is from a derived object, 
> therefore something goes wrong that the shared pointer couldn't release all 
> the memory occupied by the derived object.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to