qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jiri Daněk (Jira) <j...@apache.org>
Subject [jira] [Commented] (PROTON-1515) Python sender client doesn't check actual link state and continues to send messages even if link is down
Date Tue, 14 Jan 2020 12:12:00 GMT

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

Jiri Daněk commented on PROTON-1515:

The cause might've possibly been the fact that the test code used to look something like this,
with a while loop that called .send() and time.sleep() in between. It did not let the event
loop to run while sending, so the client did not react to link events.

  def on_sendable(self, event):
    ''' called when the sender link has credit and messages can therefore
    be transferred '''
    # close the connection if nothing to send
    if self.msg_total_cnt == 0:

    msg = self.prepare_message()

    while event.sender.credit and self.msg_sent_cnt < self.msg_total_cnt:

      if self.opts.duration != 0 and self.opts.duration_mode == 'before-send':
        time.sleep(self.opts.duration / self.msg_total_cnt)

      self.msg_sent_cnt += 1

Currently, the test method is using scheduled tasks instead of sleeps, and it does respond
to shut-down broker promptly:

FROM library/fedora:31

RUN dnf install -y wget unzip procps-ng
RUN dnf install -y java-11-openjdk-headless
RUN dnf install -y gcc gcc-c++ cmake make ninja-build pkgconf-pkg-config
RUN dnf install -y cyrus-sasl-devel cyrus-sasl-* openssl-devel python3-devel swig

RUN pip install --user cli-proton-python python-qpid-proton==0.30.0

RUN wget http://mirror.hosting90.cz/apache/activemq/activemq-artemis/2.10.1/apache-artemis-2.10.1-bin.zip
RUN unzip apache-artemis-2.10.1-bin
RUN apache-artemis-2.10.1/bin/artemis create --allow-anonymous --relax-jolokia --user admin
--password admin -- i0

# % docker build -t cli-proton-python
# % docker run --rm -ti cli-proton-python bash

# [root@7e2fb29f405a /]# /i0/bin/artemis-service start
# Starting artemis-service
# artemis-service is now running (417)

# /root/.local/bin/cli-proton-python-sender --broker-url "admin:admin@localhost:5672/jms.queue.q"
--conn-reconnect=false --count 10 --duration 100 --log-msgs=dict &

# /i0/bin/artemis-service stop
Gracefully Stopping artemis-service
Traceback (most recent call last):
  File "/root/.local/bin/cli-proton-python-sender", line 11, in <module>
    load_entry_point('cli-proton-python==1.0.5', 'console_scripts', 'cli-proton-python-sender')()
  File "/root/.local/lib/python3.7/site-packages/cli_proton_python/sender.py", line 526, in
  File "/root/.local/lib/python3.7/site-packages/proton/_reactor.py", line 184, in run
    while self.process(): pass
  File "/root/.local/lib/python3.7/site-packages/proton/_reactor.py", line 243, in process
  File "/root/.local/lib/python3.7/site-packages/proton/_events.py", line 165, in dispatch
    self.dispatch(h, type)
  File "/root/.local/lib/python3.7/site-packages/proton/_events.py", line 162, in dispatch
    _dispatch(handler, type.method, self)
  File "/root/.local/lib/python3.7/site-packages/proton/_events.py", line 125, in _dispatch
    handler.on_unhandled(method, *args)
  File "/root/.local/lib/python3.7/site-packages/cli_proton_python/coreclient.py", line 388,
in on_unhandled
    raise ClientException(err_message)
cli_proton_python.coreclient.ClientException: Connection error: amqp:connection:forced ...
[1]+  Exit 1                  /root/.local/bin/cli-proton-python-sender --broker-url "admin:admin@localhost:5672/jms.queue.q"
--conn-reconnect=false --count 10 --duration 100 --log-msgs=dict

> Python sender client doesn't check actual link state and continues to send messages even
if link is down
> --------------------------------------------------------------------------------------------------------
>                 Key: PROTON-1515
>                 URL: https://issues.apache.org/jira/browse/PROTON-1515
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: python-binding
>         Environment: RHEL7.3
> Jboss AMQ 7
> python-qpid-proton.x86_64-0.14.0-1.el7
>            Reporter: Dmitrii Puzikov
>            Assignee: Justin Ross
>            Priority: Major
>         Attachments: sender.log
> Steps to reproduce:
> 1. Start broker
> 2. Create queue
> 3. Start sending e.g. 10 messages with python sender
> 4. Kill broker
> 5. Notice that client continues send messages and raises exception only after all 10
messages were sent.
> Actual behavior: Python sender client ignores link failure until all messages were sent
and only then raises an exception/ begins re-connection attempts.
> Expected behavior: Client should stop sending messages and raise exception or try to
begin re-connection attempts if reconnect option is set.
> Please, see sender.log. Global handler was added for event logging purposes. It just
prints event/handler name.

This message was sent by Atlassian Jira

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

View raw message