You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2023/09/08 16:34:31 UTC

[impala] branch master updated: IMPALA-12273 Fix possible memory corruption of premature release of objects returned by native methods

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

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


The following commit(s) were added to refs/heads/master by this push:
     new fcbd7f0d3 IMPALA-12273 Fix possible memory corruption of premature release of objects returned by native methods
fcbd7f0d3 is described below

commit fcbd7f0d3decef20e7e1282449d220008f4d2d57
Author: qqzhang <zh...@sensorsdata.cn>
AuthorDate: Sun Jul 9 14:02:08 2023 +0800

    IMPALA-12273 Fix possible memory corruption of premature release of objects returned by native methods
    
    In the Jni Native method, there was an erroneous usage of JniLocalFrame.
    The JniLocalFrame mistakenly released the reference to the returned
    object during its destruction, causing the object to be reclaimed during
    high-concurrency garbage collection.
    
    The solution is to remove the JniLocalFrame-related code, since the
    native method does not create a local frame in JniEnv.
    
    Testing: During stress testing, there have been no further occurrences
    of memory corruption.
    
    Change-Id: I94b1c6b3f96897850512c01cdb942ebdcc59b694
    Reviewed-on: http://gerrit.cloudera.org:8080/20174
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/service/fe-support.cc | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/be/src/service/fe-support.cc b/be/src/service/fe-support.cc
index 4cb359455..2d2fa7dc0 100644
--- a/be/src/service/fe-support.cc
+++ b/be/src/service/fe-support.cc
@@ -181,7 +181,6 @@ Java_org_apache_impala_service_FeSupport_NativeEvalExprsWithoutRow(
   jbyteArray result_bytes = NULL;
   TQueryCtx query_ctx;
   TExprBatch expr_batch;
-  JniLocalFrame jni_frame;
   TResultRow expr_results;
   vector<TColumnValue> results;
   ObjectPool obj_pool;
@@ -212,9 +211,6 @@ Java_org_apache_impala_service_FeSupport_NativeEvalExprsWithoutRow(
     state.ReleaseResources();
   });
 
-  THROW_IF_ERROR_RET(
-      jni_frame.push(env), env, JniUtil::internal_exc_class(), result_bytes);
-
   MemPool expr_mem_pool(state.query_mem_tracker());
 
   // Prepare() the exprs. Always Close() the exprs even in case of errors.