This is an automated email from the ASF dual-hosted git repository.
changchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 73e11a316 [GLUTEN-5741][CH] Fix core dump when executor exits (#5787)
73e11a316 is described below
commit 73e11a3161c352282783ca2af8503f032d61d5a3
Author: exmy <[email protected]>
AuthorDate: Mon May 20 16:10:33 2024 +0800
[GLUTEN-5741][CH] Fix core dump when executor exits (#5787)
---
cpp-ch/local-engine/local_engine_jni.cpp | 1 +
.../org/apache/gluten/vectorized/JniLibLoader.java | 20 ++++++++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/cpp-ch/local-engine/local_engine_jni.cpp
b/cpp-ch/local-engine/local_engine_jni.cpp
index 63341cc53..c7721b470 100644
--- a/cpp-ch/local-engine/local_engine_jni.cpp
+++ b/cpp-ch/local-engine/local_engine_jni.cpp
@@ -201,6 +201,7 @@ JNIEXPORT jint JNI_OnLoad(JavaVM * vm, void * /*reserved*/)
JNIEXPORT void JNI_OnUnload(JavaVM * vm, void * /*reserved*/)
{
+ LOG_INFO(&Poco::Logger::get("jni"), "start jni onUnload");
local_engine::BackendFinalizerUtil::finalizeGlobally();
JNIEnv * env;
diff --git
a/gluten-core/src/main/java/org/apache/gluten/vectorized/JniLibLoader.java
b/gluten-core/src/main/java/org/apache/gluten/vectorized/JniLibLoader.java
index 31e6b0493..b1feb1e5b 100644
--- a/gluten-core/src/main/java/org/apache/gluten/vectorized/JniLibLoader.java
+++ b/gluten-core/src/main/java/org/apache/gluten/vectorized/JniLibLoader.java
@@ -82,7 +82,21 @@ public class JniLibLoader {
loaded.forEach(JniLibLoader::unloadFromPath);
}
+ private static String toRealPath(String libPath) {
+ String realPath = libPath;
+ try {
+ while (Files.isSymbolicLink(Paths.get(realPath))) {
+ realPath = Files.readSymbolicLink(Paths.get(realPath)).toString();
+ }
+ LOG.info("Read real path {} for libPath {}", realPath, libPath);
+ return realPath;
+ } catch (Throwable th) {
+ throw new GlutenException("Error to read real path for libPath: " +
libPath, th);
+ }
+ }
+
private static synchronized void loadFromPath0(String libPath, boolean
requireUnload) {
+ libPath = toRealPath(libPath);
if (LOADED_LIBRARY_PATHS.contains(libPath)) {
LOG.debug("Library in path {} has already been loaded, skipping",
libPath);
} else {
@@ -125,13 +139,10 @@ public class JniLibLoader {
return;
}
+ LOG.info("Starting unload library path: {} ", libPath);
REQUIRE_UNLOAD_LIBRARY_PATHS.remove(libPath);
try {
- while (Files.isSymbolicLink(Paths.get(libPath))) {
- libPath = Files.readSymbolicLink(Paths.get(libPath)).toString();
- }
-
ClassLoader classLoader = JniLibLoader.class.getClassLoader();
Field field = ClassLoader.class.getDeclaredField("nativeLibraries");
field.setAccessible(true);
@@ -151,6 +162,7 @@ public class JniLibLoader {
String libFileName = libFile.getName();
if (verboseFileName.equals(libFileName)) {
+ LOG.info("Finalizing library file: {}", libFileName);
Method finalize =
object.getClass().getDeclaredMethod("finalize");
finalize.setAccessible(true);
finalize.invoke(object);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]