This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 3e4df1c1c1e1 [SPARK-55679][CORE] Fix dectecting
`sun.io.serialization.extendedDebugInfo` on Java 25
3e4df1c1c1e1 is described below
commit 3e4df1c1c1e1d9f594a6afcf29b3bae05cc8a348
Author: Cheng Pan <[email protected]>
AuthorDate: Tue Feb 24 23:03:59 2026 -0800
[SPARK-55679][CORE] Fix dectecting `sun.io.serialization.extendedDebugInfo`
on Java 25
### What changes were proposed in this pull request?
Fix reading system property `sun.io.serialization.extendedDebugInfo` on
Java 24+
### Why are the changes needed?
To enable Java 25 support.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
```
$ export JAVA_HOME=/path/of/openjdk-25
$ build/sbt clean "core/testOnly *SerializationDebuggerSuite"
```
Before
```
[info] Cause: java.lang.ClassNotFoundException:
sun.security.action.GetBooleanAction
[info] at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
[info] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
[info] at java.base/java.lang.Class.forName0(Native Method)
[info] at java.base/java.lang.Class.forName(Class.java:547)
[info] at
org.apache.spark.util.SparkClassUtils.classForName(SparkClassUtils.scala:42)
[info] at
org.apache.spark.util.SparkClassUtils.classForName$(SparkClassUtils.scala:37)
[info] at
org.apache.spark.util.SparkClassUtils$.classForName(SparkClassUtils.scala:169)
[info] at
org.apache.spark.serializer.SerializationDebugger$.<clinit>(SerializationDebugger.scala:74)
[info] Run completed in 918 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 1
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] *** 1 SUITE ABORTED ***
[error] Error during tests:
[error] org.apache.spark.serializer.SerializationDebuggerSuite
[error] (core / Test / testOnly) sbt.TestsFailedException: Tests
unsuccessful
[error] Total time: 66 s (0:01:06.0), completed Feb 25, 2026, 11:25:57 AM
```
After
```
[info] Run completed in 1 second, 26 milliseconds.
[info] Total number of tests run: 22
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 22, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 61 s (0:01:01.0), completed Feb 25, 2026, 11:33:41 AM
```
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #54473 from pan3793/SPARK-55679.
Authored-by: Cheng Pan <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../spark/serializer/SerializationDebugger.scala | 25 ++++++++++++----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git
a/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala
b/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala
index da08635eca4c..21ecd05ebe32 100644
---
a/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala
+++
b/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala
@@ -20,14 +20,12 @@ package org.apache.spark.serializer
import java.io._
import java.lang.invoke.MethodHandles
import java.lang.reflect.{Field, Method}
-import java.security.{AccessController, PrivilegedAction}
import scala.annotation.tailrec
import scala.collection.mutable
import scala.util.control.NonFatal
import org.apache.spark.internal.Logging
-import org.apache.spark.util.SparkClassUtils
private[spark] object SerializationDebugger extends Logging {
@@ -69,15 +67,20 @@ private[spark] object SerializationDebugger extends Logging
{
new SerializationDebugger().visit(obj, List.empty)
}
- private[serializer] var enableDebugging: Boolean = {
- val lookup = MethodHandles.lookup()
- val clazz =
SparkClassUtils.classForName("sun.security.action.GetBooleanAction")
- val constructor = clazz.getConstructor(classOf[String])
- val mh = lookup.unreflectConstructor(constructor)
- val action = mh.invoke("sun.io.serialization.extendedDebugInfo")
- .asInstanceOf[PrivilegedAction[Boolean]]
- !AccessController.doPrivileged(action).booleanValue()
- }
+ private[serializer] var enableDebugging: Boolean =
+ if (Runtime.version().feature() >= 24) {
+ // Access plain system property on modern JDKs.
+ //
https://github.com/openjdk/jdk/commit/9b0ab92b16f682e65e9847e8127b6ce09fc5759c
+ !java.lang.Boolean.getBoolean("sun.io.serialization.extendedDebugInfo")
+ } else {
+ // Try to access the private static boolean
ObjectOutputStream.extendedDebugInfo
+ // to avoid handling SecurityManager changes across different version of
JDKs.
+ // See details at - JEP 486: Permanently Disable the Security Manager
(JDK 24)
+ val clazz = classOf[ObjectOutputStream]
+ val lookup = MethodHandles.privateLookupIn(clazz, MethodHandles.lookup())
+ val vh = lookup.findStaticVarHandle(clazz, "extendedDebugInfo",
java.lang.Boolean.TYPE)
+ !vh.get().asInstanceOf[Boolean]
+ }
private class SerializationDebugger {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]