Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-1592

[proton-python] accessing properties of event.receiver in on_link_opened throws exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • python-binding

    Description

      Apply the following patch to the tx-recv.py example

      diff --git a/examples/python/tx_recv.py b/examples/python/tx_recv.py
      index 4baddcf5..54f3b489 100755
      --- a/examples/python/tx_recv.py
      +++ b/examples/python/tx_recv.py
      @@ -40,6 +40,9 @@ class TxRecv(MessagingHandler, TransactionHandler):
               self.container.declare_transaction(self.conn, handler=self)
               self.transaction = None
       
      + def on_link_opened(self, event):
      +     event.receiver.drain_mode = True
      +
           def on_message(self, event):
               print(event.message.body)
               self.transaction.accept(event.delivery)
      

      Now run first tx_send.py, then this tx_recv.py. The second command throws exception

      $ LD_LIBRARY_PATH=`pwd`/lib64 PYTHONPATH=`pwd`/lib64/proton/bindings/python python ../examples/python/tx_recv.py
      Traceback (most recent call last):
        File "../examples/python/tx_recv.py", line 79, in <module>
          Container(TxRecv(opts.address, opts.messages, opts.batch_size)).run()
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py", line 148, in run
          while self.process(): pass
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py", line 174, in process
          self._check_errors()
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py", line 170, in _check_errors
          _compat.raise_(exc, value, tb)
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py", line 4068, in dispatch
          ev.dispatch(self.handler)
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py", line 3977, in dispatch
          result = dispatch(handler, type.method, self)
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py", line 3857, in dispatch
          return handler.on_unhandled(method, *args)
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py", line 876, in on_unhandled
          event.dispatch(handler)
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py", line 3980, in dispatch
          self.dispatch(h, type)
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py", line 3977, in dispatch
          result = dispatch(handler, type.method, self)
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py", line 3855, in dispatch
          return m(*args)
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/handlers.py", line 298, in on_link_remote_open
          self.on_link_opened(event)
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/handlers.py", line 313, in on_link_opened
          dispatch(self.delegate, 'on_link_opened', event)
        File "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py", line 3855, in dispatch
          return m(*args)
        File "../examples/python/tx_recv.py", line 44, in on_link_opened
          event.receiver.drain_mode = True
      AttributeError: 'NoneType' object has no attribute 'drain_mode'
      

      To see this is a regression, repeat now with python-qpid-proton 0.17.0 from Pypi. With this previous release, there is success.

      Attachments

        Activity

          People

            aconway Alan Conway
            jdanek Jiri Daněk
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: