Skip to content

Commit

Permalink
[fix](jni) avoid coredump if failed to get jni env (#32950) (#33012)
Browse files Browse the repository at this point in the history
  • Loading branch information
morningman authored Mar 29, 2024
1 parent 2988eed commit 2345943
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions be/src/vec/exec/jni_connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ namespace doris::vectorized {
M(TypeIndex::Float64, Float64)

JniConnector::~JniConnector() {
Status st = close();
if (!st.ok()) {
// Ensure successful resource release
LOG(FATAL) << "Failed to release jni resource: " << st.to_string();
}
static_cast<void>(close());
}

Status JniConnector::open(RuntimeState* state, RuntimeProfile* profile) {
Expand Down Expand Up @@ -200,8 +196,9 @@ Status JniConnector::close() {
_closed = true;
jthrowable exc = (env)->ExceptionOccurred();
if (exc != nullptr) {
LOG(WARNING) << "Failed to release jni resource: "
<< JniUtil::GetJniExceptionMsg(env).to_string();
// Ensure successful resource release
LOG(FATAL) << "Failed to release jni resource: "
<< JniUtil::GetJniExceptionMsg(env).to_string();
}
}
return Status::OK();
Expand Down

0 comments on commit 2345943

Please sign in to comment.