bojidar-bg opened a new pull request #8346:
URL: https://github.com/apache/ignite/pull/8346


   After investigating the 
[issue](https://issues.apache.org/jira/browse/IGNITE-13563), it seems to occur 
because `BinaryObject.Deserialize<T>()` uses `BinaryMode.Deserialize`. This, in 
turn, causes `BinaryReader.ReadBinaryObject()` to call 
`BinaryReader.Deserialize()` for the first `BinaryTypeId.Binary` object found 
(while switching to `BinaryMode.KeepBinary` for nested objects). Then, 
`BinaryReader.ReadFullObject()` gets called, and not knowing better, tries to 
deserialize the object of a nonexistent type.
   
   Now, `BinaryMode.Deserialize` is also used by `CacheClient`. However, upon 
further investigation of the values passed to `Marshaller.Unmarshall`, 
`CacheClient` unmarshalls values starting with `BinaryTypeId.Binary`, while 
`BinaryObject` unmarshalls values starting directly with `BinaryUtils.HdrFull`; 
thus, `BinaryReader` functions correctly for caches but fails with binary 
objects.
   
   Due to the this, I think the proper fix is to change 
`BinaryObject.Deserialize<T>()` to use `BinaryMode.KeepBinary`.
   
   Note: This change was initially submitted as a .patch file on the JIRA 
issue, following 
https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-2.CreateaPatch-file.
 As directed on the dev mailing list, I have made it into a PR instead.
   
   ### The Contribution Checklist
   - [x] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [x] The JIRA ticket has the _Patch Available_ state.
   - [x] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [x] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where 
`XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers 
list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers))
 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check 
PR](https://mtcga.gridgain.com/prs.html))
   
   If you need any help, please email [email protected] or ask anу advice 
on http://asf.slack.com _#ignite_ channel.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to