Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-12624

Java thin client: Wrong typeId generation for system types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.9, 2.8.1
    • binary, thin client
    • None

    Description

      Thin client generates wrong typeId for system types. This is caused by ClientMarshallerContext implementation, which always returns false for isSystemType method. These leads to typeId duplication for the same class and assertions when trying to get object by thick client. Reproducer:

      thinClient.cache(DEFAULT_CACHE_NAME).put(1, CacheAtomicityMode.ATOMIC);
      thickClient.cache(DEFAULT_CACHE_NAME).get(1);
      

      Assertion:

       

      java.lang.AssertionError: Duplicate typeId [typeId=1984564222, cls=class org.apache.ignite.cache.CacheAtomicityMode, desc=BinaryClassDescriptor [cls=class org.apache.ignite.cache.CacheAtomicityMode, serializer=null, initialSerializer=null, mapper=BinaryInternalMapper [nameMapper=BinaryBaseNameMapper [isSimpleName=true], idMapper=BinaryBaseIdMapper [isLowerCase=true], checkOnZeroId=false], mode=OPTIMIZED, userType=false, typeId=329149470, typeName=org.apache.ignite.cache.CacheAtomicityMode, affKeyFieldName=null, ctor=null, writeReplacer=null, readResolveMtd=null, stableSchema=null, schemaReg=org.apache.ignite.internal.binary.BinarySchemaRegistry@167f45f8, registered=true, useOptMarshaller=true, excluded=false, stableSchemaPublished=false]]
        at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:775)
        at org.apache.ignite.internal.binary.BinaryUtils.resolveClass(BinaryUtils.java:1669)
        at org.apache.ignite.internal.binary.BinaryEnumObjectImpl.deserialize(BinaryEnumObjectImpl.java:178)
        at org.apache.ignite.internal.binary.BinaryEnumObjectImpl.value(BinaryEnumObjectImpl.java:284)
        at org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinary(CacheObjectUtils.java:176)
        at org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinaryIfNeeded(CacheObjectUtils.java:67)
        at org.apache.ignite.internal.processors.cache.CacheObjectContext.unwrapBinaryIfNeeded(CacheObjectContext.java:136)
        at org.apache.ignite.internal.processors.cache.GridCacheContext.unwrapBinaryIfNeeded(GridCacheContext.java:1814)
      

      If we perform "put" operation with value of the same type from thick client before "get" operation, there is no assertion anymore, but typeId is still duplicated. And there is another issue: different marshallers can be used to marshal the same class for thin and thick clients, wrong class descriptor is returned for class name and there is assertion again. Reproducer:

      thickClient.cache(DEFAULT_CACHE_NAME).put(3, Collections.emptyList());
      thinClient.cache(DEFAULT_CACHE_NAME).put(2, Collections.emptyList());
      thickClient.cache(DEFAULT_CACHE_NAME).get(2);
      

      Assertion:

      java.lang.AssertionError: OptimizedMarshaller should not be used here: java.util.Collections$EmptyList
        at org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:865)
        at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1764)
        at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1716)
        at org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:792)
        at org.apache.ignite.internal.binary.BinaryObjectImpl.value(BinaryObjectImpl.java:142)
        at org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinary(CacheObjectUtils.java:176)
      
      

      Attachments

        Issue Links

          Activity

            People

              alex_pl Aleksey Plekhanov
              alex_pl Aleksey Plekhanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m