tabish121 commented on a change in pull request #3036: ARTEMIS-2669 Improve
AMQPStandardMessage::reencode on depaging not durable messages
URL: https://github.com/apache/activemq-artemis/pull/3036#discussion_r395678306
##########
File path:
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPStandardMessage.java
##########
@@ -190,6 +191,89 @@ public void reencode() {
scanMessageData();
}
+ private void reencodeOnDurabilityChangedHeaderAlreadyPresent() {
+ // only the durability property has changed: header size hasn't changed
Review comment:
This method makes an assumption that adjusting the durable value and
re-encoding the Header will not result in a size change but that in fact is not
at all certain. The encoding done by the sender cannot be guaranteed to be
exactly how the version of proton-j the broker is using will result in the same
exact size and structure. The Header described type can be marked with either
a Symbol or an UnsignedInteger which itself can either be encoded as a small
uint (2 bytes) or a normal uint (5 bytes). Same goes for the boolean values
which can be one byte or two depending on the optimizations done in the source
encoder. Same again for the TTL and DeliveryCount fields which have compact
and normal sized encodings. If that happens you will likely underwrite and
leave corrupt data in the Delivery payload as proton-j will be optimizing each
value for size.
----------------------------------------------------------------
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]
With regards,
Apache Git Services