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

Gordon Sim commented on PROTON-2439:
------------------------------------

You are right, there is indeed a bug. BlockingReceiver does not work with 
presettled deliveries as it does not settle the delivery (required by proton to 
free the delivery), but also does not expose that to the user of the class so 
they can settle it themselves. It tracks unsettled deliveries that have been 
returned in response to a receive() call in a list. Presettled deliveries are 
not placed on this list, which is why the accept etc fail.

 

I think there are two options for fixing this. One is to keep all returned 
deliveries until they are settled (i.e. remove the if clause that prevents 
presettled deliveries being appended). The other is to settle presettled 
messages instead of appending them.

 

[~astitcher] [~jr...@redhat.com] thoughts?

> Python BlockingReceiver does not work with presettled deliveries
> ----------------------------------------------------------------
>
>                 Key: PROTON-2439
>                 URL: https://issues.apache.org/jira/browse/PROTON-2439
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: python-binding
>    Affects Versions: proton-c-0.35.0
>            Reporter: Greg Majszak
>            Priority: Minor
>
> ./qpidTest.bash script:
> {{#!/usr/bin/env bash}}
>  {{ }}
>  {{function main() {}}
>  {{  # Display Linux distro}}
>  {{  echo "Linux distro:"}}
>  {{  cat /etc/*release*}}
>  {{  echo}}
>  {{ }}
>  {{  # Display Linux version}}
>  {{  echo "Linux version:"}}
>  {{  cat /proc/version}}
>  {{  echo}}
>  {{ }}
>  {{  # Display Python 3 version}}
>  {{  echo "Python3 version:"}}
>  {{  python3 --version}}
>  {{  echo}}
>  {{ }}
>  {{  # Display C++ Qpid qpidd broker version}}
>  {{  echo "C++ Qpid qpidd broker version:"}}
>  {{  qpidd --version}}
>  {{  echo}}
>  {{ }}
>  {{  echo "Run of Qpid Python 3 example broker and helloworld_blocking 
> scripts:"}}
>  {{ }}
>  {{  # Start and background Python 3 example Qpid broker}}
>  {{  python3 ~/Downloads/Qpid_Proton_0.35.0/Proton_Python_Examples/broker.py 
> &}}
>  {{  local brokerPid=$\{!}}}
>  {{ }}
>  {{  # Allow some time for Python 3 example Qpid broker to get up and 
> running}}
>  {{  sleep 1}}
>  {{ }}
>  {{  # Run helloworld_blocking.py (note no error, receiver.accept() performs 
> as expected)}}
>  {{  if [[ "Hello World!" == $(python3 
> ~/Downloads/Qpid_Proton_0.35.0/Proton_Python_Examples/helloworld_blocking.py) 
> ]]; then}}
>  {{    echo "Completed without error"}}
>  {{  else}}
>  {{    echo "Command 'python3 
> ~/Downloads/Qpid_Proton_0.35.0/Proton_Python_Examples/helloworld_blocking.py' 
> failed"}}
>  {{  fi}}
>  {{ }}
>  {{  # Stop background Python 3 example Qpid broker}}
>  {{  kill $\{brokerPid}}}
>  {{  echo}}
>  {{ }}
>  {{  echo "Run of C++ Qpid qpidd broker and helloworld_blocking script:"}}
>  {{ }}
>  {{  # Start and background C++ Qpid qpidd broker}}
>  {{  qpidd &}}
>  {{  brokerPid=$\{!}}}
>  {{ }}
>  {{  # Allow some time for C++ Qpid qpidd broker to get up and running}}
>  {{  sleep 1}}
>  {{ }}
>  {{  # Add exchange topic 'examples'}}
>  {{  qpid-config add exchange topic examples '*' || {}}
>  {{    echo "Command 'qpid-config add exchange topic examples '*'' failed"}}
> {{ }}
>  {{  # Run same helloworld_blocking.py (note error, receiver.accept() fails 
> with 'IndexError: pop from an empty deque')}}
>  {{  # If 'receiver.accept()' is commented out from helloworld_blocking.py, 
> command succeeds and returns 'Hello World!'}}
>  {{  # but message is 'leaked' and/or stored/queued awaiting acceptance}}
>  {{  if [[ "Hello World!" == $(python3 
> ~/Downloads/Qpid_Proton_0.35.0/Proton_Python_Examples/helloworld_blocking.py 
> || echo "${?}") ]]; then}}
>  {{    echo "Completed without error"}}
>  {{  else}}
>  {{    echo "'python3 
> ~/Downloads/Qpid_Proton_0.35.0/Proton_Python_Examples/helloworld_blocking.py' 
> failed"}}
>  {{  fi}}
>  {{ }}
>  {{  # Stop background C++ Qpid qpidd broker}}
>  {{  kill $\{brokerPid}}}
>  {{}}}
>  {{ }}
>  {{main "${@}"}}
>  {{ }}
>  {{exit}}
> ./qpidTest.bash script run output:
> [gmajszak@xxx-u-dev-wks20 ~]$ ./qpidTest.bash
> {{Linux distro:}}
> {{NAME="Red Hat Enterprise Linux Workstation"}}
> {{VERSION="7.6 (Maipo)"}}
> {{ID="rhel"}}
> {{ID_LIKE="fedora"}}
> {{VARIANT="Workstation"}}
> {{VARIANT_ID="workstation"}}
> {{VERSION_ID="7.6"}}
> {{PRETTY_NAME="Red Hat Enterprise Linux Workstation 7.6 (Maipo)"}}
> {{ANSI_COLOR="0;31"}}
> {{CPE_NAME="cpe:/o:redhat:enterprise_linux:7.6:GA:workstation"}}
> {{HOME_URL=[https://www.redhat.com/]}}
> {{BUG_REPORT_URL=[https://bugzilla.redhat.com/]}}
> {{REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"}}
> {{REDHAT_BUGZILLA_PRODUCT_VERSION=7.6}}
> {{REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"}}
> {{REDHAT_SUPPORT_PRODUCT_VERSION="7.6"}}
> {{Red Hat Enterprise Linux Workstation release 7.6 (Maipo)}}
> {{Red Hat Enterprise Linux Workstation release 7.6 (Maipo)}}
> {{cpe:/o:redhat:enterprise_linux:7.6:ga:workstation}}
> {{Linux version:}}
> {{Linux version 3.10.0-1160.45.1.el7.x86_64 
> ([mockbu...@x86-vm-37.build.eng.bos.redhat.com|mailto:mockbu...@x86-vm-37.build.eng.bos.redhat.com])
>  (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Fri Sep 24 
> 10:17:16 UTC 2021}}
> {{Python3 version:}}
> {{Python 3.6.8}}
> {{C++ Qpid qpidd broker version:}}
> {{qpidd (qpid-cpp) version 1.39.0}}
> {{Run of Qpid Python 3 example broker and helloworld_blocking scripts:}}
> {{Completed without error}}
> {{Run of C++ Qpid qpidd broker and helloworld_blocking script:}}
> {{2021-10-13 15:04:53 [Broker] notice Broker (pid=4832) start-up}}
> {{2021-10-13 15:04:53 [Security] notice SSL plugin not enabled, you must set 
> --ssl-cert-db to enable it.}}
> {{2021-10-13 15:04:53 [Store] notice Linear Store: Store module initialized; 
> store-dir=/home/gmajszak/.qpidd}}
> {{2021-10-13 15:04:53 [Network] notice Listening on TCP/TCP6 port 5672}}
> {{./qpidTest.bash: line 3:  4827 Terminated              python3 
> ~/Downloads/Qpid_Proton_0.35.0/Proton_Python_Examples/broker.py}}
> {{Traceback (most recent call last):}}
> {{  File 
> "/home/gmajszak/Downloads/Qpid_Proton_0.35.0/Proton_Python_Examples/helloworld_blocking.py",
>  line 32, in <module>}}
> {{    receiver.accept()}}
> {{  File "/usr/lib64/python3.6/site-packages/proton/_utils.py", line 248, in 
> accept}}
> {{    self.settle(Delivery.ACCEPTED)}}
> {{  File "/usr/lib64/python3.6/site-packages/proton/_utils.py", line 283, in 
> settle}}
> {{    self.fetcher.settle(state)}}
> {{  File "/usr/lib64/python3.6/site-packages/proton/_utils.py", line 192, in 
> settle}}
> {{    delivery = self.unsettled.popleft()}}
> {{IndexError: pop from an empty deque}}
> {{'python3 
> ~/Downloads/Qpid_Proton_0.35.0/Proton_Python_Examples/helloworld_blocking.py' 
> failed}}
> {{2021-10-13 15:04:54 [Broker] notice Broker (pid=4832) shut-down}}
> {{[gmajszak@xxx-u-dev-wks20 ~]$}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to