[ 
https://issues.apache.org/jira/browse/ARTEMIS-4725?focusedWorklogId=914867&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-914867
 ]

ASF GitHub Bot logged work on ARTEMIS-4725:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/Apr/24 13:25
            Start Date: 16/Apr/24 13:25
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on code in PR #4888:
URL: https://github.com/apache/activemq-artemis/pull/4888#discussion_r1567358070


##########
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java:
##########
@@ -825,8 +826,14 @@ protected ReadableBuffer createDeliveryCopy(int 
deliveryCount, DeliveryAnnotatio
       }
 
       writeDeliveryAnnotationsForSendBuffer(result, deliveryAnnotations);
-      // skip existing delivery annotations of the original message
-      duplicate.position(encodedHeaderSize + encodedDeliveryAnnotationsSize);
+
+      if (headerPosition > deliveryAnnotationsPosition && headerPosition != 
VALUE_NOT_PRESENT && deliveryAnnotationsPosition != VALUE_NOT_PRESENT) {
+         // this is for a case where delivery annotations was swiched wrongly 
in a previous version
+         duplicate.position(deliveryAnnotationsPosition + 
encodedDeliveryAnnotationsSize);

Review Comment:
   I tried using headerPosition+headerSize, and didn't work... I ended up 
thinking it was correct, but now that you raised this I don't know either.. :)
   
   
   let me review this.. I might need your help 





Issue Time Tracking
-------------------

    Worklog Id:     (was: 914867)
    Time Spent: 50m  (was: 40m)

> Mirror may send wrong headers
> -----------------------------
>
>                 Key: ARTEMIS-4725
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4725
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Clebert Suconic
>            Assignee: Clebert Suconic
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> This is not specifically an issue in Mirroring or Broker Connection, but it 
> manifested as part of the broker connection codebase.
> When a delivery for the first time after a reload happens, the delivery 
> annotation may be written before the header, breaking the specification. 
> Later on delivery the message, createDelieryCopy could get confused with the 
> positions:
> https://github.com/apache/activemq-artemis/blob/50fae08b09a76e200ef107d06cc867231f644ccd/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java#L829



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to