Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-9345

DivertConfiguration encoding is broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • None
    • None

      Modifying divert with transformer in a high-availability (HA) cluster with Apache Artemis by broker.xml results in an IndexOutOfBoundsException error in the backup logs. This error breaks the connection between the primary and backup brokers, initiates a quorum vote, and causes the backup to become active, leading to both brokers operating in parallel.

      Steps to Reproduce the Error

      1. Create primary broker

      apache-artemis-2.35.0/bin/artemis.cmd create --host=localhost --default-port=61611 --http-port=8111 --clustered --cluster-user=cls --cluster-password=cls --replicated --name=br11 --user=usr --password=usr --allow-anonymous --no-autotune --no-amqp-acceptor --no-hornetq-acceptor --no-mqtt-acceptor --no-stomp-acceptor br11

      2. Create backup broker

      apache-artemis-2.35.0/bin/artemis.cmd create --host=localhost --default-port=61612 --http-port=8112 --clustered --cluster-user=cls --cluster-password=cls --replicated --backup --name=br12 --user=usr --password=usr --allow-anonymous --no-autotune --no-amqp-acceptor --no-hornetq-acceptor --no-mqtt-acceptor --no-stomp-acceptor br12

      3. Start brokers
      4. Add test addresses to primary broker.xml:

      <address name="TEST.IN">
         <anycast>
            <queue name="TEST.IN"/>
         </anycast>
      </address>
      <address name="TEST.OUT">
         <anycast>
            <queue name="TEST.OUT"/>
         </anycast>
      </address>

      5. Add divert with transformer to primary broker.xml

      <diverts>
         <divert name="TEST-DIVERT">
            <address>TEST.IN</address>
            <forwarding-address>TEST.OUT</forwarding-address>
            <filter string="LABEL='Test'"/>
            <transformer>
               <class-name>org.apache.activemq.artemis.core.server.transformer.AddHeadersTransformer</class-name>
            </transformer>
         </divert>
      </diverts>

      Result

      • an IndexOutOfBoundsException error will appear in the backup logs, e.g.:
        ERROR [org.apache.activemq.artemis.core.client] AMQ214013: Failed to decode packet
        java.lang.IndexOutOfBoundsException: readerIndex(28) + length(209) exceeds writerIndex(233): PooledUnsafeDirectByteBuf(ridx: 28, widx: 233, cap: 233)
        	at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1442) ~[netty-buffer-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1428) ~[netty-buffer-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:895) ~[netty-buffer-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:903) ~[netty-buffer-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.buffer.WrappedByteBuf.readBytes(WrappedByteBuf.java:657) ~[netty-buffer-4.1.111.Final.jar:4.1.111.Final]
        	at org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readBytes(ChannelBufferWrapper.java:310) ~[artemis-commons-2.35.0.jar:2.35.0]
        	at org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationAddMessage.decodeRest(ReplicationAddMessage.java:113) ~[artemis-server-2.35.0.jar:2.35.0]
        	at org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.decode(PacketImpl.java:385) ~[artemis-core-client-2.35.0.jar:2.35.0]
        	at org.apache.activemq.artemis.core.protocol.ServerPacketDecoder.slowPathDecode(ServerPacketDecoder.java:292) ~[artemis-server-2.35.0.jar:2.35.0]
        	at org.apache.activemq.artemis.core.protocol.ServerPacketDecoder.decode(ServerPacketDecoder.java:156) ~[artemis-server-2.35.0.jar:2.35.0]
        	at org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:386) [artemis-core-client-2.35.0.jar:2.35.0]
        	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl$DelegatingBufferHandler.bufferReceived(ClientSessionFactoryImpl.java:1365) [artemis-core-client-2.35.0.jar:2.35.0]
        	at org.apache.activemq.artemis.core.remoting.impl.netty.ActiveMQChannelHandler.channelRead(ActiveMQChannelHandler.java:73) [artemis-core-client-2.35.0.jar:2.35.0]
        	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) [netty-codec-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) [netty-codec-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1407) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) [netty-transport-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:994) [netty-common-4.1.111.Final.jar:4.1.111.Final]
        	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.111.Final.jar:4.1.111.Final]
      • the connection between primary and backup will be broken
      • a quorum vote will be initiated
      • the backup will become active and will operate in parallel with the primary

              rhn-support-jbertram Justin Bertram
              rh-messaging-ci Messaging CI
              Samuel Gajdos Samuel Gajdos
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: