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

SyncRequestResponse(BlockingConnection).call() fails with timeout

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.17.0
    • Fix Version/s: proton-c-0.19.0
    • Component/s: python-binding
    • Labels:
    • Environment:
      macOS Sierra 10.12.5
      Python 3.6.1

      Description

      Send a QMFv2 message using SyncRequestResponse.call(). The response times out.

      Repro

      This repro uses the example from https://qpid.apache.org/releases/qpid-proton-0.17.0/proton/python/examples/sync_client.py.html.

      $ python
      Python 3.6.1 (default, Apr 24 2017, 09:59:45)
      [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
      Type "help", "copyright", "credits" or "license" for more information.
      >>> address = 'amqps://REDACTED_USERNAME:REDACTED_PASSWORD@REDACTED_IP_ADDR:5672/qmf.default.direct'
      >>> from proton import Url
      >>> url = Url(address)
      >>>
      >>> from proton.utils import SyncRequestResponse, BlockingConnection
      >>> client = SyncRequestResponse(BlockingConnection(url, timeout=15, target='qmf.default.direct', sasl_enabled=True, allowed_mechs='PLAIN'), 'qmf.default.direct')
      >>>
      >>> content = {'_what': 'OBJECT', '_schema_id': {'_class_name': 'queue'}}
      >>> properties = {'x-amqp-0-10.app-id': 'qmf2', 'qmf.opcode': '_query_request', 'method': 'request'}
      >>>
      >>> from proton import Message
      >>> m = Message(reply_to=client.receiver.remote_source.address, address=address, body=content, properties=properties, subject='broker')
      >>> r = client.call(m)
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/Users/hamza.sheikh/virtualenvs/flight-test-py36/lib/python3.6/site-packages/proton/utils.py", line 400, in call
          self.connection.wait(wakeup, msg="Waiting for response")
        File "/Users/hamza.sheikh/virtualenvs/flight-test-py36/lib/python3.6/site-packages/proton/utils.py", line 288, in wait
          raise Timeout(txt)
      proton.Timeout: Connection amqps://REDACTED_USERNAME:REDACTED_PASSWORD@REDACTED_IP_ADDR:5672/qmf.default.direct timed out: Waiting for response
      >>>
      

      Patch

      Patch is to make sure correlation_id is a string.

      $ git diff
      diff --git a/proton-c/bindings/python/proton/utils.py b/proton-c/bindings/python/proton/utils.py
      index 05ef80df..528ce338 100644
      --- a/proton-c/bindings/python/proton/utils.py
      +++ b/proton-c/bindings/python/proton/utils.py
      @@ -349,7 +349,7 @@ class SyncRequestResponse(IncomingMessageHandler):
               if not self.address and not request.address:
                   raise ValueError("Request message has no address: %s" % request)
               request.reply_to = self.reply_to
      -        request.correlation_id = correlation_id = self.correlation_id.next()
      +        request.correlation_id = correlation_id = str(self.correlation_id.next())
               self.sender.send(request)
               def wakeup():
                   return self.response and (self.response.correlation_id == correlation_id)
      
      

      After applying the patch, the response does not time out.

      $ python
      Python 3.6.1 (default, Apr 24 2017, 09:59:45)
      [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
      Type "help", "copyright", "credits" or "license" for more information.
      >>> address = 'amqps://REDACTED_USERNAME:REDACTED_PASSWORD@REDACTED_IP_ADDR:5672/qmf.default.direct'
      >>> from proton import Url
      >>> url = Url(address)
      >>>
      >>> from proton.utils import SyncRequestResponse, BlockingConnection
      >>> client = SyncRequestResponse(BlockingConnection(url, timeout=15, target='qmf.default.direct', sasl_enabled=True, allowed_mechs='PLAIN'), 'qmf.default.direct')
      >>>
      >>> content = {'_what': 'OBJECT', '_schema_id': {'_class_name': 'queue'}}
      >>> properties = {'x-amqp-0-10.app-id': 'qmf2', 'qmf.opcode': '_query_request', 'method': 'request'}
      >>>
      >>> from proton import Message
      >>> m = Message(reply_to=client.receiver.remote_source.address, address=address, body=content, properties=properties, subject='broker')
      >>> r = client.call(m)
      >>> r.body
      [{'_create_ts': ulong(1500315523092865467), '_delete_ts': ulong(0), '_object_id': {'_agent_epoch': ulong(3), '_object_name': b'org.apache.qpid.broker:queue:420cb745-f3c7-4a47-ac09-0a4711f10058:1.0'}, '_schema_id': {'_class_name': b'queue', '_hash': UUID('84ce326e-2cbd-6899-80d7-6267d3327e0f'), '_package_name': b'org.apache.qpid.broker', '_type': b'_data'}, '_update_ts': ulong(1500315525896122413), '_values': {'acquires': ulong(1), 'arguments': {}, 'autoDelete': True, 'bindingCount': uint(2), 'bindingCountHigh': uint(2), 'bindingCountLow': uint(2), 'byteDepth': ulong(0), 'byteFtdDepth': ulong(0), 'byteFtdDequeues': ulong(0), 'byteFtdEnqueues': ulong(0), 'bytePersistDequeues': ulong(0), 'bytePersistEnqueues': ulong(0), 'byteTotalDequeues': ulong(189), 'byteTotalEnqueues': ulong(189), 'byteTxnDequeues': ulong(0), 'byteTxnEnqueues': ulong(0), 'consumerCount': uint(1), 'consumerCountHigh': uint(1), 'consumerCountLow': uint(1), 'creator': b'REDACTED_USERNAME@QPID', 'discardsLvq': ulong(0), 'discardsOverflow': ulong(0), 'discardsPurge': ulong(0), 'discardsRing': ulong(0), 'discardsSubscriber': ulong(0), 'discardsTtl': ulong(0), 'durable': False, 'exclusive': True, 'flowStopped': False, 'flowStoppedCount': uint(0), 'messageLatencyAvg': int32(0), 'messageLatencyCount': ulong(0), 'messageLatencyMax': ulong(0), 'messageLatencyMin': int32(0), 'msgDepth': ulong(0), 'msgFtdDepth': ulong(0), 'msgFtdDequeues': ulong(0), 'msgFtdEnqueues': ulong(0), 'msgPersistDequeues': ulong(0), 'msgPersistEnqueues': ulong(0), 'msgTotalDequeues': ulong(1), 'msgTotalEnqueues': ulong(1), 'msgTxnDequeues': ulong(0), 'msgTxnEnqueues': ulong(0), 'name': b'420cb745-f3c7-4a47-ac09-0a4711f10058:1.0', 'redirectPeer': b'', 'redirectSource': False, 'releases': ulong(0), 'reroutes': ulong(0), 'unackedMessages': uint(0), 'unackedMessagesHigh': uint(0), 'unackedMessagesLow': uint(0), 'vhostRef': {'_object_name': b'org.apache.qpid.broker:vhost:org.apache.qpid.broker:broker:amqp-broker,/'}}}]
      >>> exit()
      Assertion failed: (r == 0), function k5_mutex_lock, file ../../include/k5-thread.h, line 366.
      Abort trap: 6
      $
      

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user aikchar opened a pull request:

          https://github.com/apache/qpid-proton/pull/110

          Fix for PROTON-1517

          Fixes the bug reported in PROTON-1517(https://issues.apache.org/jira/browse/PROTON-1517).

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/aikchar/qpid-proton fix-PROTON-1517

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/qpid-proton/pull/110.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #110


          commit a4dafa2cfaccf181ffff2c0d3a5a25aeddb26dbb
          Author: Hamza Sheikh <code@codeghar.com>
          Date: 2017-07-18T00:04:02Z

          Fix for PROTON-1517


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user aikchar opened a pull request: https://github.com/apache/qpid-proton/pull/110 Fix for PROTON-1517 Fixes the bug reported in PROTON-1517 ( https://issues.apache.org/jira/browse/PROTON-1517 ). You can merge this pull request into a Git repository by running: $ git pull https://github.com/aikchar/qpid-proton fix- PROTON-1517 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/qpid-proton/pull/110.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #110 commit a4dafa2cfaccf181ffff2c0d3a5a25aeddb26dbb Author: Hamza Sheikh <code@codeghar.com> Date: 2017-07-18T00:04:02Z Fix for PROTON-1517
          Hide
          justi9 Justin Ross added a comment -

          I can reproduce this problem, but near as I can tell, it's not a bug in the python binding really. With print debugging, I see a numeric correlation ID (intentionally) sent in the request to the qpidd agent, and I see a string correlation ID returned. Everything works with the patch because it makes the correlation ID a string in every instance.

          My theory is that the qpidd qmf code assumes and requires string correlation IDs, and implicitly converts to a string internally, but it's hard for me to tell from the C++ code. Ted Ross, is that a reasonable theory?

          Show
          justi9 Justin Ross added a comment - I can reproduce this problem, but near as I can tell, it's not a bug in the python binding really. With print debugging, I see a numeric correlation ID (intentionally) sent in the request to the qpidd agent, and I see a string correlation ID returned. Everything works with the patch because it makes the correlation ID a string in every instance. My theory is that the qpidd qmf code assumes and requires string correlation IDs, and implicitly converts to a string internally, but it's hard for me to tell from the C++ code. Ted Ross , is that a reasonable theory?
          Hide
          tedross Ted Ross added a comment -

          This is correct. The message implementation within qpidd treats the correlationId as a string. The QMF agent in the broker uses this implementation.

          Show
          tedross Ted Ross added a comment - This is correct. The message implementation within qpidd treats the correlationId as a string. The QMF agent in the broker uses this implementation.
          Hide
          justi9 Justin Ross added a comment -

          I bumped this to 0.19.0, at which point we can consider taking this patch as an accommodation or come up with some other approach.

          Show
          justi9 Justin Ross added a comment - I bumped this to 0.19.0, at which point we can consider taking this patch as an accommodation or come up with some other approach.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1d2d791921bea582b27778bf0b5ebb1853c7e95a in qpid-proton's branch refs/heads/master from Alan Conway
          [ https://git-wip-us.apache.org/repos/asf?p=qpid-proton.git;h=1d2d791 ]

          PROTON-1517: C++ consistent linkage for listen_handler

          Make it all non-inline, consistent with message_handler.
          Fixes ASAN runtime warnings caused by duplicate vtables.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1d2d791921bea582b27778bf0b5ebb1853c7e95a in qpid-proton's branch refs/heads/master from Alan Conway [ https://git-wip-us.apache.org/repos/asf?p=qpid-proton.git;h=1d2d791 ] PROTON-1517 : C++ consistent linkage for listen_handler Make it all non-inline, consistent with message_handler. Fixes ASAN runtime warnings caused by duplicate vtables.

            People

            • Assignee:
              justi9 Justin Ross
              Reporter:
              aikchar aikchar
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:

                Development