[
https://issues.apache.org/jira/browse/DISPATCH-960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16452917#comment-16452917
]
ASF GitHub Bot commented on DISPATCH-960:
-----------------------------------------
Github user ted-ross commented on a diff in the pull request:
https://github.com/apache/qpid-dispatch/pull/284#discussion_r184177949
--- Diff: src/amqp.c ---
@@ -73,11 +76,24 @@ const char * const QD_AMQP_COND_FRAME_SIZE_TOO_SMALL =
"amqp:frame-size-too-smal
const char * const QD_AMQP_PORT_STR = "5672";
const char * const QD_AMQPS_PORT_STR = "5671";
+const char * const QD_AMQP_DFLT_PROTO = "tcp";
+
int qd_port_int(const char* port_str) {
if (!strcmp(port_str, QD_AMQP_PORT_STR)) return QD_AMQP_PORT_INT;
if (!strcmp(port_str, QD_AMQPS_PORT_STR)) return QD_AMQPS_PORT_INT;
errno = 0;
unsigned long n = strtoul(port_str, NULL, 10);
if (errno || n > 0xFFFF) return -1;
+
+ // Port is not an integer (port = 'amqp' or 'amqps')
+ if ( !n && strlen(port_str) > 0 ) {
+ // Resolve service port
+ struct servent *serv_info = getservbyname(port_str,
QD_AMQP_DFLT_PROTO);
--- End diff --
The man page for getservbyname states that this call is
multi-thread-unsafe. This should be replaced by a thread-safe equivalent to
avoid concurrency issues.
> TCP port randomly assigned when using 'port: amqp' along with 'http: yes' on
> a listener
> ---------------------------------------------------------------------------------------
>
> Key: DISPATCH-960
> URL: https://issues.apache.org/jira/browse/DISPATCH-960
> Project: Qpid Dispatch
> Issue Type: Bug
> Affects Versions: 1.0.1
> Reporter: Fernando Giorgetti
> Priority: Major
> Attachments: dispatch-960-reproducer.tar.gz
>
>
> The default configuration for the dispatch router contains a default listener
> set up to use 'port: amqp'.
> If you change the default listener to use 'http: yes' and starts the router,
> it causes an issue as the service name (amqp) is not resolved, and so the
> router attempts to listen to port 0 (random), causing an unpredictable
> behavior.
>
> A reproducer is attached to this issue.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]