Skip to content

Serialization ContentTypeId conflict between avro protocol and protocoluff protocol #3926

@feixz

Description

@feixz
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.2-SNAPSHOT
  • Operating System version: OS X 10.14.4
  • Java version: 1.8.0_202

Steps to reproduce this issue

  1. [DUBBO] Serialization extension org.apache.dubbo.common.serialize.protostuff.ProtostuffSerialization has duplicate id to Serialization extension org.apache.dubbo.common.serialize.avro.AvroSerialization, ignore this Serialization extension
CodecSupport
static {
        Set<String> supportedExtensions = ExtensionLoader.getExtensionLoader(Serialization.class).getSupportedExtensions();
        for (String name : supportedExtensions) {
            Serialization serialization = ExtensionLoader.getExtensionLoader(Serialization.class).getExtension(name);
            byte idByte = serialization.getContentTypeId();
            if (ID_SERIALIZATION_MAP.containsKey(idByte)) {
                logger.error("Serialization extension " + serialization.getClass().getName()
                        + " has duplicate id to Serialization extension "
                        + ID_SERIALIZATION_MAP.get(idByte).getClass().getName()
                        + ", ignore this Serialization extension");
                continue;
            }
            ID_SERIALIZATION_MAP.put(idByte, serialization);
            ID_SERIALIZATIONNAME_MAP.put(idByte, name);
        }
    }

public class ProtostuffSerialization implements Serialization {
    @Override
    public byte getContentTypeId() {
        return 10;
    }
}

public class AvroSerialization implements Serialization {
    @Override
    public byte getContentTypeId() {
        return 10;
    }
}

Metadata

Metadata

Assignees

Labels

type/bugBugs to being fixed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions