Commit 8eb9e34
[SPARK-51537][CONNECT][CORE][3.5] construct the session-specific classloader based on the default session classloader on executor
### What changes were proposed in this pull request?
This PR is to construct the session-specific classloader based on the default session classloader which has already added the global jars (e.g., added by `--jars` ) into the classpath on the executor side in the connect mode.
### Why are the changes needed?
In Spark Connect mode, when connecting to a non-local (e.g., standalone) cluster, the executor creates an isolated session state that includes a session-specific classloader for each task. However, a notable issue arises: this session-specific classloader does not include the global JARs specified by the --jars option in the classpath. This oversight can lead to deserialization exceptions. For example:
``` console
Caused by: java.lang.ClassCastException: cannot assign instance of java.lang.invoke.SerializedLambda to field org.apache.spark.rdd.MapPartitionsRDD.f of type scala.Function3 in instance of org.apache.spark.rdd.MapPartitionsRDD
at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2096)
```
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
The newly added test can pass.
### Was this patch authored or co-authored using generative AI tooling?
No
Closes apache#50475 from wbo4958/classloader-3.5.
Authored-by: Bobby Wang <wbo4958@gmail.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>1 parent 50634db commit 8eb9e34
File tree
2 files changed
+57
-13
lines changed- core/src
- main/scala/org/apache/spark/executor
- test/scala/org/apache/spark/executor
2 files changed
+57
-13
lines changedLines changed: 30 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
| 179 | + | |
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
| |||
1029 | 1030 | | |
1030 | 1031 | | |
1031 | 1032 | | |
1032 | | - | |
| 1033 | + | |
| 1034 | + | |
1033 | 1035 | | |
1034 | 1036 | | |
1035 | 1037 | | |
| |||
1041 | 1043 | | |
1042 | 1044 | | |
1043 | 1045 | | |
1044 | | - | |
| 1046 | + | |
1045 | 1047 | | |
1046 | 1048 | | |
1047 | | - | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1048 | 1052 | | |
1049 | 1053 | | |
1050 | 1054 | | |
1051 | 1055 | | |
1052 | 1056 | | |
1053 | 1057 | | |
1054 | | - | |
| 1058 | + | |
1055 | 1059 | | |
1056 | | - | |
| 1060 | + | |
1057 | 1061 | | |
1058 | 1062 | | |
1059 | 1063 | | |
1060 | | - | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
1061 | 1071 | | |
1062 | | - | |
| 1072 | + | |
1063 | 1073 | | |
1064 | | - | |
| 1074 | + | |
1065 | 1075 | | |
1066 | 1076 | | |
1067 | 1077 | | |
1068 | 1078 | | |
1069 | 1079 | | |
1070 | | - | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
1071 | 1087 | | |
1072 | 1088 | | |
1073 | 1089 | | |
1074 | | - | |
| 1090 | + | |
1075 | 1091 | | |
1076 | 1092 | | |
1077 | 1093 | | |
1078 | 1094 | | |
1079 | 1095 | | |
1080 | | - | |
| 1096 | + | |
1081 | 1097 | | |
1082 | 1098 | | |
1083 | 1099 | | |
| |||
1176 | 1192 | | |
1177 | 1193 | | |
1178 | 1194 | | |
1179 | | - | |
| 1195 | + | |
| 1196 | + | |
1180 | 1197 | | |
1181 | 1198 | | |
1182 | 1199 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
112 | 139 | | |
0 commit comments