New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-5470][Core]use defaultClassLoader to load classes in KryoSerializer #4258
Conversation
Test build #26281 has started for PR 4258 at commit
|
LGTM, I test this with spark-branch 1.2, it works correctly. :) |
Test build #26281 has finished for PR 4258 at commit
|
Test PASSed. |
@@ -97,7 +87,9 @@ class KryoSerializer(conf: SparkConf) | |||
// Use the default classloader when calling the user registrator. | |||
Thread.currentThread.setContextClassLoader(classLoader) | |||
// Register classes given through spark.kryo.classesToRegister. | |||
classesToRegister.foreach { clazz => kryo.register(clazz) } | |||
classesToRegister.split(',') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do the splitting and filtering during initialization so that we don't incur them for each task?
Test build #26447 has started for PR 4258 at commit
|
@sryza thank you. I have updated for your comment. Can you review again? |
Test build #26447 has finished for PR 4258 at commit
|
Test PASSed. |
LGTM |
Test build #26528 has started for PR 4258 at commit
|
Test build #26528 has finished for PR 4258 at commit
|
Test FAILed. |
Jenkins, retest this please. |
Test build #26707 has started for PR 4258 at commit
|
Test build #26707 has finished for PR 4258 at commit
|
Test PASSed. |
This looks like a logical change, since it makes sense to use the provided default classloader to register user classes, just as it's already used to create the serializer. Given reviews from 3 other people and confirmation this does what's intended, it seems like a good fix to merge. |
I've cherry-picked this into |
…lizer Now KryoSerializer load classes of classesToRegister at the time of its initialization. when we set spark.kryo.classesToRegister=class1, it will throw SparkException("Failed to load class to register with Kryo". because in KryoSerializer's initialization, classLoader cannot include class of user's jars. we need to use defaultClassLoader of Serializer in newKryo(), because executor will reset defaultClassLoader of Serializer after Serializer's initialization. thank zzcclp for reporting it to me. Author: lianhuiwang <lianhuiwang09@gmail.com> Closes #4258 from lianhuiwang/SPARK-5470 and squashes the following commits: 73b719f [lianhuiwang] do the splitting and filtering during initialization 64cf306 [lianhuiwang] use defaultClassLoader to load classes of classesToRegister in KryoSerializer
Now KryoSerializer load classes of classesToRegister at the time of its initialization. when we set spark.kryo.classesToRegister=class1, it will throw SparkException("Failed to load class to register with Kryo".
because in KryoSerializer's initialization, classLoader cannot include class of user's jars.
we need to use defaultClassLoader of Serializer in newKryo(), because executor will reset defaultClassLoader of Serializer after Serializer's initialization.
thank @zzcclp for reporting it to me.