[ 
https://issues.apache.org/jira/browse/IGNITE-12624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17031625#comment-17031625
 ] 

Aleksey Plekhanov commented on IGNITE-12624:
--------------------------------------------

Test {{FunctionalTest#testDataTypes}} should be fixed (see TODO with ticket 
number) as part of fix for this ticket.

> Java thin client: Wrong typeId generation for system types
> ----------------------------------------------------------
>
>                 Key: IGNITE-12624
>                 URL: https://issues.apache.org/jira/browse/IGNITE-12624
>             Project: Ignite
>          Issue Type: Bug
>          Components: binary, thin client
>            Reporter: Aleksey Plekhanov
>            Assignee: Aleksey Plekhanov
>            Priority: Major
>
> 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:
> {code:java}
> thinClient.cache(DEFAULT_CACHE_NAME).put(1, CacheAtomicityMode.ATOMIC);
> thickClient.cache(DEFAULT_CACHE_NAME).get(1);
> {code}
> Assertion:
>  
> {noformat}
> 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)
> {noformat}
> 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:
> {code:java}
> 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);
> {code}
> Assertion:
> {noformat}
> 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)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to