Robbie Gemmell updated PROTON-971:
    Attachment: PROTON-971_test.patch

Attaching a test that demonstrates the issue.

Proton-c passes the test and doesn't seem to have this issue. This appears to 
be because it prepares all frames it can (up to the session window limit) for a 
delivery at once, either completing the delivery (which prevents the issue) or 
exhausting the sessions ability to send any further transfer frames for that 
delivery or any subsequent ones on the session (and thus the link).

> [proton-j] multi-frame deliveries may be broken when sent if buffered along 
> with a futher delivery for the same link
> --------------------------------------------------------------------------------------------------------------------
>                 Key: PROTON-971
>                 URL: https://issues.apache.org/jira/browse/PROTON-971
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: proton-j
>    Affects Versions: 0.10
>            Reporter: Robbie Gemmell
>            Priority: Critical
>             Fix For: 0.11
>         Attachments: PROTON-971_test.patch
> Proton-j sends at most a single frame for a delivery in each call to 
> "processTransportWorkSender(DeliveryImpl delivery, SenderImpl snd)", which 
> occurs for each sent delivery on the 'transport work list' in turn during the 
> "processTransportWork" call. That call is made twice for each process of the 
> transport. As such, at most 2 frames for each delivery can be emitted for 
> each process of the transport. However, because all deliveries on the 
> connections 'transport work list' are processed in turn by 
> "processTransportWork", it is possible that interleaved transfer frames for 
> subsequent deliveries on the same link will also be emitted if there are 
> other buffered deliveries on the work list and the session window and frame 
> writer 'isFUll' checks permit it.
> This in itself would already be illegal [1] even if the frames were otherwise 
> correct, but the erroenous transfer frames also get marked with the wrong 
> delivery-id since that is only incremented by the transport when a delivery 
> has been completed, so if it was not all sent yet then the 
> initial/interleaved transfer frames for the subsequent delivery are also 
> stamped with the same id. Proton-j uses the delivery-id while consitituting 
> received deliveries, and thus the mismatch results in interleaving of the 
> payload from the later delivery within that for the earlier delivery.
> [1] 
> http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#doc-idp484080
> "However, messages transferred along a single link MUST NOT be interleaved."

This message was sent by Atlassian JIRA

Reply via email to