[ https://issues.apache.org/jira/browse/ARTEMIS-1859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16723106#comment-16723106 ]
ASF GitHub Bot commented on ARTEMIS-1859: ----------------------------------------- Github user gemmellr commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2464#discussion_r242205353 --- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java --- @@ -216,9 +219,23 @@ public RemotingConnection getRemotingConnection() { flow(); } - public RoutingType getRoutingType(Receiver receiver, SimpleString address) { + public RoutingType getRoutingType(Receiver receiver, SimpleString address, AMQPMessage message) { org.apache.qpid.proton.amqp.messaging.Target target = (org.apache.qpid.proton.amqp.messaging.Target) receiver.getRemoteTarget(); - return target != null ? getRoutingType(target.getCapabilities(), address) : getRoutingType((Symbol[]) null, address); + // the target may be null or have no capabilities in the case of an anonymous producer + if (target != null && target.getCapabilities() != null) { --- End diff -- Doing this for each message seems a[n existing?] waste. Also, the comment and check aren't really achieving what seems to be desired, which is to know if its not an anonymous producer. This part of the process could be done once when the link first attaches, with the routing type value deduced and used here later rather than repeating the process over and over. The initial attachment is also a better point in time to establish whether it is an anonymous producer or not. The Anonymous Relay is represented by the target with null address, but nothing prevents there being capabilities associated with it, so this check could erroneously catch an anonymous producer link. It should inspect the link target address to make the distinction. > Incorrect routing with AMQP anonymous producer & auto-created queue > ------------------------------------------------------------------- > > Key: ARTEMIS-1859 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1859 > Project: ActiveMQ Artemis > Issue Type: Bug > Components: AMQP > Affects Versions: 2.6.0 > Reporter: Jiri Daněk > Priority: Major > > Consider the reproducer in the attached PR. Previously, only topic > autocreation was attempted in these integration tests. When _queue_ is to be > autocreated this way, the broker would still autocreate a topic, and so the > new queue autocreation test fails. > It would seem that the broker is ignoring the "x-opt-jms-dest" message > annotation, which qpid-jms correctly sets to 0x0 (a queue). > There is opportunity for one more test to be written. What would happen if I > try to send a message intended to a topic on a message producer which is > producing to a queue (of the same name). There should be some error thrown, I > guess. > CC [~gemmellr], [~tabish121] > The error from {{testAnonymousProducerWithQueueAutoCreation}} is > {noformat} > [org.apache.commons.beanutils.converters.ArrayConverter] : No conversion > required, value is already a java.net.URL[] > [main] 11:08:21,877 INFO [org.apache.activemq.artemis.core.server] > AMQ221000: live Message Broker is starting with configuration Broker > Configuration > (clustered=false,journalDirectory=/home/jdanek/Work/repos/activemq-artemis/tests/integration-tests/./target/tmp/junit2516012081350811450/journal0-L5672,bindingsDirectory=/home/jdanek/Work/repos/activemq-artemis/tests/integration-tests/./target/tmp/junit2516012081350811450/bindings0-L5672,largeMessagesDirectory=/home/jdanek/Work/repos/activemq-artemis/tests/integration-tests/./target/tmp/junit2516012081350811450/large-msg0-L,pagingDirectory=/home/jdanek/Work/repos/activemq-artemis/tests/integration-tests/./target/tmp/junit2516012081350811450/page0-L5672) > [main] 11:08:21,945 INFO [org.apache.activemq.artemis.core.server] > AMQ221013: Using NIO Journal > SLF4J: Class path contains multiple SLF4J bindings. > SLF4J: Found binding in > [jar:file:/home/jdanek/.m2/repository/org/apache/karaf/org.apache.karaf.client/4.0.6/org.apache.karaf.client-4.0.6.jar!/org/slf4j/impl/StaticLoggerBinder.class] > SLF4J: Found binding in > [jar:file:/home/jdanek/.m2/repository/org/ops4j/pax/logging/pax-logging-api/1.8.5/pax-logging-api-1.8.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] > SLF4J: Found binding in > [jar:file:/home/jdanek/.m2/repository/org/slf4j/slf4j-log4j12/1.7.21/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class] > SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an > explanation. > SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory] > [main] 11:08:22,270 INFO [org.apache.activemq.artemis.core.server] > AMQ221043: Protocol module found: [artemis-server]. Adding protocol support > for: CORE > [main] 11:08:22,271 INFO [org.apache.activemq.artemis.core.server] > AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol > support for: AMQP > [main] 11:08:22,271 INFO [org.apache.activemq.artemis.core.server] > AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol > support for: STOMP > [main] 11:08:22,272 INFO [org.apache.activemq.artemis.core.server] > AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding > protocol support for: OPENWIRE > [main] 11:08:22,272 INFO [org.apache.activemq.artemis.core.server] > AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol > support for: HORNETQ > [main] 11:08:22,273 INFO [org.apache.activemq.artemis.core.server] > AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol > support for: MQTT > [main] 11:08:22,425 INFO [org.apache.activemq.artemis.core.server] > AMQ221034: Waiting indefinitely to obtain live lock > [main] 11:08:22,425 INFO [org.apache.activemq.artemis.core.server] > AMQ221035: Live Server Obtained live lock > [org.apache.commons.beanutils.BeanUtils] : > BeanUtils.populate(org.apache.activemq.artemis.protocol.amqp.broker.ProtonProtocolManager@38c5cc4c, > {anycastPrefix=anycast://, multicastPrefix=multicast://}) > [org.apache.commons.beanutils.ConvertUtils] : Convert string 'anycast://' to > class 'java.lang.String' > [org.apache.commons.beanutils.converters.StringConverter] : Converting > 'String' value 'anycast://' to type 'String' > [org.apache.commons.beanutils.ConvertUtils] : Convert string 'multicast://' > to class 'java.lang.String' > [org.apache.commons.beanutils.converters.StringConverter] : Converting > 'String' value 'multicast://' to type 'String' > [org.apache.commons.beanutils.BeanUtils] : > BeanUtils.populate(org.apache.activemq.artemis.core.protocol.openwire.OpenWireProtocolManager@76508ed1, > {anycastPrefix=anycast://, multicastPrefix=multicast://}) > [org.apache.commons.beanutils.ConvertUtils] : Convert string 'anycast://' to > class 'java.lang.String' > [org.apache.commons.beanutils.converters.StringConverter] : Converting > 'String' value 'anycast://' to type 'String' > [org.apache.commons.beanutils.ConvertUtils] : Convert string 'multicast://' > to class 'java.lang.String' > [org.apache.commons.beanutils.converters.StringConverter] : Converting > 'String' value 'multicast://' to type 'String' > [main] 11:08:23,166 ERROR [org.apache.activemq.artemis.core.server] > AMQ224000: Failure in initialisation: > io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address > already in use > at io.netty.channel.unix.Errors.newIOException(Errors.java:122) > [netty-transport-native-unix-common-4.1.24.Final.jar:4.1.24.Final] > at io.netty.channel.unix.Socket.bind(Socket.java:287) > [netty-transport-native-unix-common-4.1.24.Final.jar:4.1.24.Final] > at > io.netty.channel.epoll.AbstractEpollChannel.doBind(AbstractEpollChannel.java:688) > [netty-transport-native-epoll-4.1.24.Final-linux-x86_64.jar:4.1.24.Final] > at > io.netty.channel.epoll.EpollServerSocketChannel.doBind(EpollServerSocketChannel.java:70) > [netty-transport-native-epoll-4.1.24.Final-linux-x86_64.jar:4.1.24.Final] > at > io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:558) > [netty-transport-4.1.24.Final.jar:4.1.24.Final] > at > io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1358) > [netty-transport-4.1.24.Final.jar:4.1.24.Final] > at > io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501) > [netty-transport-4.1.24.Final.jar:4.1.24.Final] > at > io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486) > [netty-transport-4.1.24.Final.jar:4.1.24.Final] > at > io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:1019) > [netty-transport-4.1.24.Final.jar:4.1.24.Final] > at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:254) > [netty-transport-4.1.24.Final.jar:4.1.24.Final] > at > io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:366) > [netty-transport-4.1.24.Final.jar:4.1.24.Final] > at > io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) > [netty-common-4.1.24.Final.jar:4.1.24.Final] > at > io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) > [netty-common-4.1.24.Final.jar:4.1.24.Final] > at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:309) > [netty-transport-native-epoll-4.1.24.Final-linux-x86_64.jar:4.1.24.Final] > at > io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) > [netty-common-4.1.24.Final.jar:4.1.24.Final] > at > org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118) > [:] > [main] 11:08:23,167 INFO [org.apache.activemq.artemis.core.server] > AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.6.0-SNAPSHOT > [localhost, nodeID=da78638f-54fa-11e8-9211-228524672ac6] > [main] 11:08:23,980 INFO [org.apache.activemq.artemis.core.server] > AMQ221002: Apache ActiveMQ Artemis Message Broker version 2.6.0-SNAPSHOT > [da78638f-54fa-11e8-9211-228524672ac6] stopped, uptime 2.141 seconds > [main] 11:08:24,238 INFO [org.apache.activemq.artemis.core.server] **** end > #test testAnonymousQueueProducerWithAutoCreation() *** > javax.jms.JMSException: Address 979f219c-11a4-4f94-ab6c-f2a930825b64 is not > configured for queue support [condition = amqp:illegal-state] > at > org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToException(AmqpSupport.java:164) > at > org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToException(AmqpSupport.java:117) > at > org.apache.qpid.jms.provider.amqp.builders.AmqpResourceBuilder.handleClosed(AmqpResourceBuilder.java:185) > at > org.apache.qpid.jms.provider.amqp.builders.AmqpResourceBuilder.processRemoteClose(AmqpResourceBuilder.java:129) > at > org.apache.qpid.jms.provider.amqp.AmqpProvider.processUpdates(AmqpProvider.java:995) > at > org.apache.qpid.jms.provider.amqp.AmqpProvider.access$1900(AmqpProvider.java:105) > at > org.apache.qpid.jms.provider.amqp.AmqpProvider$17.run(AmqpProvider.java:854) > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at java.lang.Thread.run(Thread.java:748) > Process finished with exit code 255 > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)