[ 
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.

{noformat}
  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:
      event.connection.close()

    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)

      event.sender.send(msg)
      self.msg_sent_cnt += 1
...
{noformat}

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

{noformat}
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
{noformat}

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

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

{noformat}
# /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 &
{noformat}

{noformat}
# /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 main
    container.run()
  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
    event.dispatch(self._global_handler)
  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
{noformat}

> 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
(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