[ 
https://issues.apache.org/jira/browse/DISPATCH-1287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16792956#comment-16792956
 ] 

Gordon Sim commented on DISPATCH-1287:
--------------------------------------

To reproduce:

1. run simple_recv.py -m 1
2. start attached drainable.py
3. after the second message has been sent by drainable.py (about 10 seconds 
later) start a consumer again: simple_recv.py -m 1000

The trace below shows that after the draining of credit, when credit is 
subsequently restored, it is done one credit at a time.

{noformat}
[0x55ddd54175e0]:  -> SASL
[0x55ddd54175e0]:  <- SASL
[0x55ddd54175e0]:0 <- @sasl-mechanisms(64) 
[sasl-server-mechanisms=@PN_SYMBOL[:ANONYMOUS]]
[0x55ddd54175e0]:0 -> @sasl-init(65) [mechanism=:ANONYMOUS, 
initial-response=b"[email protected]"]
[0x55ddd54175e0]:0 <- @sasl-outcome(68) [code=0]
[0x55ddd54175e0]:  -> AMQP
[0x55ddd54175e0]:0 -> @open(16) 
[container-id="c717a8c8-017b-4a86-bb18-a0b32e4969d7", hostname="localhost", 
channel-max=32767]
[0x55ddd54175e0]:0 -> @begin(17) [next-outgoing-id=0, 
incoming-window=2147483647, outgoing-window=2147483647]
[0x55ddd54175e0]:0 -> @attach(18) 
[name="c717a8c8-017b-4a86-bb18-a0b32e4969d7-examples", handle=0, role=false, 
snd-settle-mode=2, rcv-settle-mode=0, source=@source(40) [durable=0, timeout=0, 
dynamic=false], target=@target(41) [address="examples", durable=0, timeout=0, 
dynamic=false], initial-delivery-count=0, max-message-size=0]
[0x55ddd54175e0]:  <- AMQP
[0x55ddd54175e0]:0 <- @open(16) [container-id="Standalone_A9d50TgVriH1LKq", 
max-frame-size=16384, channel-max=32767, idle-time-out=8000, 
offered-capabilities=:"ANONYMOUS-RELAY", 
properties={:product="qpid-dispatch-router", :version="1.6.0-SNAPSHOT", 
:"qd.conn-id"=23}]
[0x55ddd54175e0]:0 <- @begin(17) [remote-channel=0, next-outgoing-id=0, 
incoming-window=2147483647, outgoing-window=2147483647]
[0x55ddd54175e0]:0 <- @attach(18) 
[name="c717a8c8-017b-4a86-bb18-a0b32e4969d7-examples", handle=0, role=true, 
snd-settle-mode=2, rcv-settle-mode=0, source=@source(40) [durable=0, 
expiry-policy=:"session-end", timeout=0, dynamic=false], target=@target(41) 
[address="examples", durable=0, expiry-policy=:"session-end", timeout=0, 
dynamic=false], initial-delivery-count=0, max-message-size=0]
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=0, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=0, link-credit=250, drain=false]
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=0, 
delivery-tag=b"1", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x01\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x01"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=1, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=1, link-credit=250, drain=false]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=0, settled=true, 
state=@accepted(36) []]
[0x55ddd54175e0]:0 -> (EMPTY FRAME)
[0x55ddd54175e0]:0 -> (EMPTY FRAME)
Sending next batch
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=1, 
delivery-tag=b"2", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x02\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x02"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=2, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=2, link-credit=249, drain=true]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=1, settled=true, 
state=@released(38) []]
[0x55ddd54175e0]:0 -> @flow(19) [next-incoming-id=0, 
incoming-window=2147483647, next-outgoing-id=2, outgoing-window=2147483647, 
handle=0, delivery-count=251, link-credit=0, drain=true]
[0x55ddd54175e0]:0 -> (EMPTY FRAME)
[0x55ddd54175e0]:0 -> (EMPTY FRAME)
Sending next batch
[0x55ddd54175e0]:0 -> (EMPTY FRAME)
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=2, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=251, link-credit=1, drain=false]
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=2, 
delivery-tag=b"3", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x03\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x03"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=3, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=252, link-credit=1, drain=false]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=2, settled=true, 
state=@accepted(36) []]
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=3, 
delivery-tag=b"4", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x04\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x04"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=4, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=253, link-credit=1, drain=false]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=3, settled=true, 
state=@accepted(36) []]
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=4, 
delivery-tag=b"5", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x05\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x05"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=5, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=254, link-credit=1, drain=false]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=4, settled=true, 
state=@accepted(36) []]
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=5, 
delivery-tag=b"6", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x06\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x06"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=6, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=255, link-credit=1, drain=false]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=5, settled=true, 
state=@accepted(36) []]
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=6, 
delivery-tag=b"7", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x07\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x07"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=7, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=256, link-credit=1, drain=false]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=6, settled=true, 
state=@accepted(36) []]
[0x55ddd54175e0]:0 -> (EMPTY FRAME)
Sending next batch
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=7, 
delivery-tag=b"8", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x08\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x08"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=8, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=257, link-credit=1, drain=false]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=7, settled=true, 
state=@accepted(36) []]
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=8, 
delivery-tag=b"9", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x09\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x09"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=9, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=258, link-credit=1, drain=false]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=8, settled=true, 
state=@accepted(36) []]
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=9, 
delivery-tag=b"10", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x0a\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x0a"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=10, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=259, link-credit=1, drain=false]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=9, settled=true, 
state=@accepted(36) []]
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=10, 
delivery-tag=b"11", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x0b\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x0b"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=11, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=260, link-credit=1, drain=false]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=10, settled=true, 
state=@accepted(36) []]
[0x55ddd54175e0]:0 -> @transfer(20) [handle=0, delivery-id=11, 
delivery-tag=b"12", message-format=0] (42) 
"\x00SpE\x00Ss\xd0\x00\x00\x00\x06\x00\x00\x00\x01S\x0c\x00Sw\xd1\x00\x00\x00\x10\x00\x00\x00\x02\xa1\x08sequenceT\x0c"
[0x55ddd54175e0]:0 <- @flow(19) [next-incoming-id=12, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=0, delivery-count=261, link-credit=1, drain=false]
[0x55ddd54175e0]:0 <- @disposition(21) [role=true, first=11, settled=true, 
state=@accepted(36) []]

{noformat}

> router gets confused by clients response to drain and subsequently issue too 
> little credit
> ------------------------------------------------------------------------------------------
>
>                 Key: DISPATCH-1287
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-1287
>             Project: Qpid Dispatch
>          Issue Type: Bug
>    Affects Versions: 1.5.0
>            Reporter: Gordon Sim
>            Priority: Major
>             Fix For: 1.6.0
>
>         Attachments: drainable.py
>
>
> A sender is opened for an address on which there is a receiver. It sends one 
> messages which is accepted. The receiver then detaches and the sender tries 
> to send another message. This second message is released and the router 
> attempts to drain the senders credit.
> The sender responds to the drain request by not sending any further messages 
> but incrementing the delivery_count by the appropriate amount.
> If a receiver attaches on the address again after this point, the router 
> issues credit back to the sender, but only issues link-credit=1.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to