Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 871410

Summary: [RFE] c++ (high-level API) client reconnect_urls URL parser should handle all URL list combinations (including prefixes 'amqp:' '<transport>:')
Product: Red Hat Enterprise MRG Reporter: Frantisek Reznicek <freznice>
Component: qpid-cppAssignee: messaging-bugs <messaging-bugs>
Status: CLOSED UPSTREAM QA Contact: MRG Quality Engineering <mrgqe-bugs>
Severity: low Docs Contact:
Priority: low    
Version: DevelopmentCC: astitcher, jross
Target Milestone: ---Keywords: FutureFeature, Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-02-10 03:21:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Frantisek Reznicek 2012-10-30 12:02:37 UTC
Description of problem:

c++ (high-level API) client reconnect_urls URL parser does not handle all possible BNF cases.

C++ connection url format is defined following way (as far as I know):
[amqp:][<transport>:]<host>[:<port>]

Qpid C++ client reconnect feature allows user to specify list of reconnect URLs to multiple brokers.
Unfortunately at the moment current c++ url list parser does not work as expected.

See below 6 cases which in my view represent valid list of addresses, some of them fail atm.

[1] [root@dhcp-27- messaging]# ./drain "sdfdsf" --connection-options "{reconnect: true, reconnect_limit: 1,reconnect_urls: '127.0.0.1:5675,127.0.0.1:5672'}"
    2012-10-30 12:37:40 [Network] warning Connect failed: Connection refused
    2012-10-30 12:37:40 [Client] warning Connection  closed
    ...
    2012-10-30 12:37:40 [Network] warning Connect failed: Connection refused
    2012-10-30 12:37:40 [Client] warning Connection  closed
    Failed to connect within reconnect limit
[2] [root@dhcp-27- messaging]# ./drain "sdfdsf" --connection-options "{reconnect: true, reconnect_limit: 1,reconnect_urls: 'amqp:127.0.0.1:5675,127.0.0.1:5672'}"
    2012-10-30 12:37:56 [Network] warning Connect failed: Connection refused
    2012-10-30 12:37:56 [Client] warning Connection  closed
    ...
    2012-10-30 12:37:56 [Network] warning Connect failed: Connection refused
    2012-10-30 12:37:56 [Client] warning Connection  closed
    Failed to connect within reconnect limit
[3] [root@dhcp-27- messaging]# ./drain "sdfdsf" --connection-options "{reconnect: true, reconnect_limit: 1,reconnect_urls: 'amqp:127.0.0.1:5675,amqp:127.0.0.1:5672'}"
    2012-10-30 12:38:02 [Network] warning Connect failed: Connection refused
    2012-10-30 12:38:02 [Client] warning Connection  closed
    Invalid URL: amqp:127.0.0.1:5675,amqp:127.0.0.1:5672 (qpid/Url.cpp:259)
[4] [root@dhcp-27- messaging]# ./drain "sdfdsf" --connection-options "{reconnect: true, reconnect_limit: 1,reconnect_urls: 'amqp:tcp:127.0.0.1:5675,127.0.0.1:5672'}"
    2012-10-30 12:38:10 [Network] warning Connect failed: Connection refused
    2012-10-30 12:38:10 [Client] warning Connection  closed
    ...
    2012-10-30 12:38:10 [Network] warning Connect failed: Connection refused
    2012-10-30 12:38:10 [Client] warning Connection  closed
    Failed to connect within reconnect limit
[5] [root@dhcp-27- messaging]# ./drain "sdfdsf" --connection-options "{reconnect: true, reconnect_limit: 1,reconnect_urls: 'amqp:tcp:127.0.0.1:5675,amqp:127.0.0.1:5672'}"
    2012-10-30 12:38:16 [Network] warning Connect failed: Connection refused
    2012-10-30 12:38:16 [Client] warning Connection  closed
    Invalid URL: amqp:tcp:127.0.0.1:5675,amqp:127.0.0.1:5672 (qpid/Url.cpp:259)
[6] [root@dhcp-27- messaging]# ./drain "sdfdsf" --connection-options "{reconnect: true, reconnect_limit: 1,reconnect_urls: 'amqp:tcp:127.0.0.1:5675,amqp:tcp:127.0.0.1:5672'}"
    2012-10-30 12:38:21 [Network] warning Connect failed: Connection refused
    2012-10-30 12:38:21 [Client] warning Connection  closed
    Invalid URL: amqp:tcp:127.0.0.1:5675,amqp:tcp:127.0.0.1:5672 (qpid/Url.cpp:259)


Shortly cases [3], [5], [6] define at lest one of [amqp:][<transport>:] URl prefixes and parses does not like it.


URL parser should validate all above cases as correct list of URLs as customers may need to prioritize usage of different transports using reconnect_urls for instance:
  reconnect_urls: 'amqp:ssl:<host>:<port>,amqp:tcp:<host>:<port>'
  
This is not currently supported by qpid c++ client.



Version-Release number of selected component (if applicable):
qpid-cpp*-0.18-2.el*

How reproducible:
100%

Steps to Reproduce:
0. Install qpid c++ client
1. cd /usr/share/qpidc/examples/messaging ; make
2. ./drain "sdfdsf" --connection-options "{reconnect: true, reconnect_limit: 1,reconnect_urls: 'amqp:tcp:127.0.0.1:5675,amqp:tcp:127.0.0.1:5672'}"
3. # Invalid URL
  
Actual results:
Invalid URL for valid cases.

Expected results:
Valid URL for all valid cases.

Additional info:

Comment 2 Andrew Stitcher 2012-10-31 17:36:24 UTC
I'm not sure this is a bug at all, perhaps a misunderstanding or bad (non existent?) documentation

The current URL parser has this syntax (copied verbatim from qpid/Url.cpp)

url = ["amqp:"][ user ["/" password] "@" ] protocol_addr *("," protocol_addr)
protocol_addr = tcp_addr / rmda_addr / ssl_addr / .. others plug-in
tcp_addr = ["tcp:"] host [":" port]
rdma_addr = "rdma:" host [":" port]
ssl_addr = "ssl:" host [":" port]

So note that it's only the protocol_addr elements that can be repeated, not the entire specification. so the amqp: and user and password elements are not repeated. They're not repeated because they are common.

So "amqp:tcp:127.0.0.1:5675,amqp:tcp:127.0.0.1:5672" is not valid. But
"amqp:tcp:127.0.0.1:5675,tcp:127.0.0.1:5672" is valid.

In short: cases 3-6 are not valid urls.

Close not a bug.

[If you think this url syntax or the overall parsing should be improved raise a feature request. I think that the python url parsing works the way you expect the c++ parsing to work so I can understand the confusion]

Comment 3 Frantisek Reznicek 2012-11-01 15:28:05 UTC
Correct, documentation is not very explicit about supported forms in URL list.
I think it is better to extend a bit the functionality and document, rather than just document current state.

Thus reopening as feature request.

All following URL list strings should be considered as valid:

127.0.0.1:5675,127.0.0.1:5672
tcp:127.0.0.1:5675,ssl:127.0.0.1:5672
127.0.0.1:5675,ssl:127.0.0.1:5672
127.0.0.1:5675,amqp:ssl:127.0.0.1:5672           (*)
amqp:tcp:127.0.0.1:5675,ssl:127.0.0.1:5672
amqp:tcp:127.0.0.1:5675,amqp:127.0.0.1:5672      (*)
tcp:127.0.0.1:5675,amqp:ssl:127.0.0.1:5672       (*)
amqp:tcp:127.0.0.1:5675,amqp:tcp:127.0.0.1:5672  (*)

URL versions marked as (*) are not functional atm.

Next version suggested, severity lowered.

Comment 6 Red Hat Bugzilla 2025-02-10 03:21:00 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.