Ganesh Murthy commented on PROTON-1006:

Did a little bit analysis on what is going on - 

The BlockingSender's send function (python/proton/utils.py) has a call to 
self.connection.wait as shown below -  

class BlockingSender(BlockingLink):
    def send(self, msg, timeout=False, error_states=None):
        delivery = self.link.send(msg)
        self.connection.wait(lambda: delivery.settled, msg="Sending on sender 
%s" % self.link.name, timeout=timeout)
        bad = error_states
        if bad is None:
            bad = [Delivery.REJECTED, Delivery.RELEASED]
        if delivery.remote_state in bad:
            raise SendException(delivery.remote_state)
        return delivery

The above code in turn calls the send function in the Message class - 
{code:title=class Message|borderStyle=solid}
  def send(self, sender, tag=None):
    dlv = sender.delivery(tag or sender.delivery_tag())
    encoded = self.encode()
    if sender.snd_settle_mode == Link.SND_SETTLED:
    return dlv

The dlv.settle() call goes through successfully but the lambda: 
delivery.settled always returns False and the BlockingSender's send waits  

> Sending pre-settled messages over the python blocking api waits indefinetly
> ---------------------------------------------------------------------------
>                 Key: PROTON-1006
>                 URL: https://issues.apache.org/jira/browse/PROTON-1006
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: python-binding
>    Affects Versions: 0.10
>            Reporter: Ganesh Murthy
>            Assignee: Gordon Sim
>             Fix For: 0.10.1
>         Attachments: helloworld_blocking_presettled.py
> Sending a pre-settled message (snd_settle_mode = Link.SND_SETTLED) over a 
> blocking connection (using a blocking sender) blocks indefinetly.
> Steps to reproduce - 
> 1. Modify the helloworld_blocking.py (located in examples/python folder) to 
> add an AtMostOnce() call before creating the sender (or use the attached file 
> helloworld_blocking_presettled.py)
> 2. Start broker.py (located in examples/python folder)
> 3. Run helloworld_blocking_presettled.py
> You will see that the send is blocking indefinetly.

This message was sent by Atlassian JIRA

Reply via email to