Stephan Ewen commented on FLINK-8836:

I see. We can check what Kryo's philosophy on serializers is, but I would 
assume that they should be stateless. It seems quite exotic to make those 

Personally, I cannot recall a case when there ever was a stateful Kryo 
serializer. We could clearly document and require that in user-defined Kryo 

Going to the point that we pro-actively serialization-copy all user-defined 
serializers is possible as well, as a hard last resort. We could do that for 
all serializers that have fields and are passed not as classes, but objects.

> Duplicating a KryoSerializer does not duplicate registered default serializers
> ------------------------------------------------------------------------------
>                 Key: FLINK-8836
>                 URL: https://issues.apache.org/jira/browse/FLINK-8836
>             Project: Flink
>          Issue Type: Bug
>          Components: Type Serialization System
>            Reporter: Tzu-Li (Gordon) Tai
>            Priority: Critical
> The {{duplicate()}} method of the {{KryoSerializer}} is as following:
> {code:java}
> public KryoSerializer<T> duplicate() {
>     return new KryoSerializer<>(this);
> }
> protected KryoSerializer(KryoSerializer<T> toCopy) {
>     defaultSerializers = toCopy.defaultSerializers;
>     defaultSerializerClasses = toCopy.defaultSerializerClasses;
>     kryoRegistrations = toCopy.kryoRegistrations;
>     ...
> }
> {code}
> Shortly put, when duplicating a {{KryoSerializer}}, the 
> {{defaultSerializers}} serializer instances are directly provided to the new 
> {{KryoSerializer}} instance.
>  This causes the fact that those default serializers are shared across two 
> different {{KryoSerializer}} instances, and therefore not a correct duplicate.

This message was sent by Atlassian JIRA

Reply via email to