aboutsummaryrefslogtreecommitdiff
path: root/spark-common
diff options
context:
space:
mode:
authorlucko <git@lucko.me>2024-07-18 22:03:36 +0100
committerGitHub <noreply@github.com>2024-07-18 22:03:36 +0100
commit8379f2b07bc38c24733c4f1d537ea7c2ee03d91b (patch)
tree0f9a2dcfc1a9becf997ca19129673a44ae1c4be6 /spark-common
parented8eac595c26719571683cff7f3c9de2cfc28406 (diff)
downloadspark-8379f2b07bc38c24733c4f1d537ea7c2ee03d91b.tar.gz
spark-8379f2b07bc38c24733c4f1d537ea7c2ee03d91b.tar.bz2
spark-8379f2b07bc38c24733c4f1d537ea7c2ee03d91b.zip
Add spark-paper module (#422)
Diffstat (limited to 'spark-common')
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java24
-rwxr-xr-xspark-common/src/main/resources/spark-native/linux/aarch64/libasyncProfiler.so (renamed from spark-common/src/main/resources/spark/linux/aarch64/libasyncProfiler.so)bin343408 -> 343408 bytes
-rwxr-xr-xspark-common/src/main/resources/spark-native/linux/amd64-musl/libasyncProfiler.so (renamed from spark-common/src/main/resources/spark/linux/amd64-musl/libasyncProfiler.so)bin317560 -> 317560 bytes
-rwxr-xr-xspark-common/src/main/resources/spark-native/linux/amd64/libasyncProfiler.so (renamed from spark-common/src/main/resources/spark/linux/amd64/libasyncProfiler.so)bin361312 -> 361312 bytes
-rwxr-xr-xspark-common/src/main/resources/spark-native/macos/libasyncProfiler.so (renamed from spark-common/src/main/resources/spark/macos/libasyncProfiler.so)bin724576 -> 724576 bytes
5 files changed, 21 insertions, 3 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java
index 192275b..7dcb131 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java
@@ -114,13 +114,19 @@ public class AsyncProfilerAccess {
if (this.setupException instanceof UnsupportedSystemException) {
platform.getPlugin().log(Level.INFO, "The async-profiler engine is not supported for your os/arch (" +
this.setupException.getMessage() + "), so the built-in Java engine will be used instead.");
+ } else if (this.setupException instanceof UnsupportedJvmException) {
+ platform.getPlugin().log(Level.INFO, "The async-profiler engine is not supported for your JVM (" +
+ this.setupException.getMessage() + "), so the built-in Java engine will be used instead.");
} else if (this.setupException instanceof NativeLoadingException && this.setupException.getCause().getMessage().contains("libstdc++")) {
platform.getPlugin().log(Level.WARNING, "Unable to initialise the async-profiler engine because libstdc++ is not installed.");
platform.getPlugin().log(Level.WARNING, "Please see here for more information: https://spark.lucko.me/docs/misc/Using-async-profiler#install-libstdc");
} else {
- platform.getPlugin().log(Level.WARNING, "Unable to initialise the async-profiler engine: " + this.setupException.getMessage());
+ String error = this.setupException.getMessage();
+ if (this.setupException.getCause() != null) {
+ error += " (" + this.setupException.getCause().getMessage() + ")";
+ }
+ platform.getPlugin().log(Level.WARNING, "Unable to initialise the async-profiler engine: " + error);
platform.getPlugin().log(Level.WARNING, "Please see here for more information: https://spark.lucko.me/docs/misc/Using-async-profiler");
- this.setupException.printStackTrace();
}
}
@@ -140,6 +146,12 @@ public class AsyncProfilerAccess {
// check compatibility
String os = System.getProperty("os.name").toLowerCase(Locale.ROOT).replace(" ", "");
String arch = System.getProperty("os.arch").toLowerCase(Locale.ROOT);
+ String jvm = System.getProperty("java.vm.name");
+
+ // openj9 not supported by async-profiler at the moment
+ if (jvm.contains("OpenJ9")) {
+ throw new UnsupportedJvmException(jvm);
+ }
if (os.equals("linux") && arch.equals("amd64") && isLinuxMusl()) {
arch = "amd64-musl";
@@ -159,7 +171,7 @@ public class AsyncProfilerAccess {
}
// extract the profiler binary from the spark jar file
- String resource = "spark/" + libPath + "/libasyncProfiler.so";
+ String resource = "spark-native/" + libPath + "/libasyncProfiler.so";
URL profilerResource = AsyncProfilerAccess.class.getClassLoader().getResource(resource);
if (profilerResource == null) {
throw new IllegalStateException("Could not find " + resource + " in spark jar file");
@@ -224,6 +236,12 @@ public class AsyncProfilerAccess {
}
}
+ private static final class UnsupportedJvmException extends UnsupportedOperationException {
+ public UnsupportedJvmException(String jvm) {
+ super(jvm);
+ }
+ }
+
private static final class NativeLoadingException extends RuntimeException {
public NativeLoadingException(Throwable cause) {
super("A runtime error occurred whilst loading the native library", cause);
diff --git a/spark-common/src/main/resources/spark/linux/aarch64/libasyncProfiler.so b/spark-common/src/main/resources/spark-native/linux/aarch64/libasyncProfiler.so
index 800cf91..800cf91 100755
--- a/spark-common/src/main/resources/spark/linux/aarch64/libasyncProfiler.so
+++ b/spark-common/src/main/resources/spark-native/linux/aarch64/libasyncProfiler.so
Binary files differ
diff --git a/spark-common/src/main/resources/spark/linux/amd64-musl/libasyncProfiler.so b/spark-common/src/main/resources/spark-native/linux/amd64-musl/libasyncProfiler.so
index 3c81d1c..3c81d1c 100755
--- a/spark-common/src/main/resources/spark/linux/amd64-musl/libasyncProfiler.so
+++ b/spark-common/src/main/resources/spark-native/linux/amd64-musl/libasyncProfiler.so
Binary files differ
diff --git a/spark-common/src/main/resources/spark/linux/amd64/libasyncProfiler.so b/spark-common/src/main/resources/spark-native/linux/amd64/libasyncProfiler.so
index 5af5071..5af5071 100755
--- a/spark-common/src/main/resources/spark/linux/amd64/libasyncProfiler.so
+++ b/spark-common/src/main/resources/spark-native/linux/amd64/libasyncProfiler.so
Binary files differ
diff --git a/spark-common/src/main/resources/spark/macos/libasyncProfiler.so b/spark-common/src/main/resources/spark-native/macos/libasyncProfiler.so
index 4930c67..4930c67 100755
--- a/spark-common/src/main/resources/spark/macos/libasyncProfiler.so
+++ b/spark-common/src/main/resources/spark-native/macos/libasyncProfiler.so
Binary files differ