[jboss-jira] [JBoss JIRA] (JGRP-2289) FRAG4: handle ObjectMessage whose size() method is incorrect

Bela Ban (Jira) issues at jboss.org
Thu Jan 9 07:00:46 EST 2020


     [ https://issues.redhat.com/browse/JGRP-2289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bela Ban updated JGRP-2289:
---------------------------
    Fix Version/s: 5.1
                       (was: 5.0)


> FRAG4: handle ObjectMessage whose size() method is incorrect
> ------------------------------------------------------------
>
>                 Key: JGRP-2289
>                 URL: https://issues.redhat.com/browse/JGRP-2289
>             Project: JGroups
>          Issue Type: Enhancement
>            Reporter: Bela Ban
>            Assignee: Bela Ban
>            Priority: Major
>             Fix For: 5.1
>
>
> When an ObjectMessage has a {{SizeStreamable}} object whose size() returns more bytes than are actually written, {{FRAG4}} will block on reading of the last fragment. Example: size() returns 27 bytes (LENGTH), but we only write 20 bytes, then {{readFully()}} (used to read the fragments) will throw an exception (EOF, IIRC).
> To fix this, {{FragmentedMessage.writeTo()}} could do the following:
> * Check if DataOutput is of type ByteArrayDataOutputStream. This is almost always the case as this is used on the bundler base class. If not -> use the current code path
> * Remember the current position
> * Write LENGTH bytes (27 in the example above)
> * Call obj.writeTo(out)
> * If the current position is *not* equal to the remembered position + LENGTH:
> ** Position the output stream back to the remembered position and write the correct length ACTUAL bytes (20) as an int
> Obviously, this only works for DataOutput implementations that support position(), but with most bundlers using ByteArrayDataOutputStream, this should be the case most of the time.



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jboss-jira mailing list