You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by mi...@apache.org on 2018/06/20 21:48:04 UTC
impala git commit: IMPALA-7150: fixes jni frame scope
Repository: impala
Updated Branches:
refs/heads/master 11aaa6caa -> 2b1970abe
IMPALA-7150: fixes jni frame scope
A previous change (https://gerrit.cloudera.org/#/c/9968/)
reduced the time that a lib-cache entry was held when initializing
a udf. It did so by introducing a new scope. However, that scope
captured a jni frame, which resulted in an earlier frame pop
than before. This change decouples the frame scope from the lib-cache
scope so that the frame is popped at the end of the method (as before)
instread of with the lib-cache scope.
Testing:
- core, asan tests pass
Change-Id: I38d482dde6ed7f8857ae565bf62a8e923ffb0ae9
Reviewed-on: http://gerrit.cloudera.org:8080/10746
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/2b1970ab
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/2b1970ab
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/2b1970ab
Branch: refs/heads/master
Commit: 2b1970abef16d1db6b01aead06204cb035ff7e82
Parents: 11aaa6c
Author: Vuk Ercegovac <ve...@cloudera.com>
Authored: Thu Jun 14 23:59:09 2018 -0700
Committer: Impala Public Jenkins <im...@cloudera.com>
Committed: Wed Jun 20 21:33:14 2018 +0000
----------------------------------------------------------------------
be/src/exprs/hive-udf-call.cc | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/impala/blob/2b1970ab/be/src/exprs/hive-udf-call.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/hive-udf-call.cc b/be/src/exprs/hive-udf-call.cc
index b7715b7..22683ca 100644
--- a/be/src/exprs/hive-udf-call.cc
+++ b/be/src/exprs/hive-udf-call.cc
@@ -198,7 +198,10 @@ Status HiveUdfCall::OpenEvaluator(FunctionContext::FunctionStateScope scope,
JNIEnv* env = getJNIEnv();
if (env == NULL) return Status("Failed to get/create JVM");
+ // Add a scoped cleanup jni reference object. This cleans up local refs made below.
+ JniLocalFrame jni_frame;
{
+ // Scoped handle for libCache entry.
LibCacheEntryHandle handle;
string local_location;
RETURN_IF_ERROR(LibCache::instance()->GetLocalPath(fn_.hdfs_location,
@@ -219,12 +222,13 @@ Status HiveUdfCall::OpenEvaluator(FunctionContext::FunctionStateScope scope,
jbyteArray ctor_params_bytes;
- // Add a scoped cleanup jni reference object. This cleans up local refs made below.
- JniLocalFrame jni_frame;
+ // Pushed frame will be popped when jni_frame goes out-of-scope.
RETURN_IF_ERROR(jni_frame.push(env));
RETURN_IF_ERROR(SerializeThriftMsg(env, &ctor_params, &ctor_params_bytes));
- // Create the java executor object
+ // Create the java executor object. The jar referenced by the libCache handle
+ // is not needed after the next call, so it is safe for the handle to go
+ // out-of-scope after the java object is instantiated.
jni_ctx->executor = env->NewObject(executor_cl_, executor_ctor_id_, ctor_params_bytes);
}
RETURN_ERROR_IF_EXC(env);