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

SyncRequestResponse(BlockingConnection).call() fails with timeout

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: proton-c-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
    • Flags:
      Patch

      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
      $
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: