[
https://issues.apache.org/jira/browse/ARTEMIS-4910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17866750#comment-17866750
]
ASF subversion and git services commented on ARTEMIS-4910:
----------------------------------------------------------
Commit 1a8322071168e6d33053cc47dd8f657280c0ed64 in activemq-artemis's branch
refs/heads/main from Justin Bertram
[ https://gitbox.apache.org/repos/asf?p=activemq-artemis.git;h=1a83220711 ]
ARTEMIS-4910 fix divert config encoding
This commit fixes 4 distinct issues with divert configuration encoding:
- The encoding size was calculated incorrectly in three ways:
- Using 0 instead of `DataConstants.SIZE_NULL` when no transformer is
defined resulting in a calculated size discrepancy of -1.
- Using `DataConstants.INT` instead of `DataConstants.SIZE_INT` for
the number of transformer properties resulting in a calculated size
discrepancy of +2 when using a configuration with a transformer.
- Using `BufferHelper.sizeOfNullableBoolean` instead of
`DataConstants.SIZE_BOOLEAN` for the `exclusive` property resulting
in a calculated discrepancy of +1.
- Encoding was using `writeString` instead of `writeNullableString` for
the name of the transformer class resulting in an actual buffer size
discrepancy of -1.
Aside from these fixes this commit also:
- Updates the divert storage test to force a reload from disk which
will also trigger this problem.
- Adds new tests specifically for encoding & decoding include a test to
verify known bytes during encoding.
Lastly, it's worth noting that this *won't fix* bad data that was
already stored to disk by an older broker or bad data that comes over
the wire from an older broker (e.g. if a older primary broker paired
with a newer backup).
> Synchronization of HA cluster after modifying divert with transformer failure
> -----------------------------------------------------------------------------
>
> Key: ARTEMIS-4910
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4910
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: Broker, Clustering, Configuration
> Affects Versions: 2.35.0
> Reporter: Kirill Chadakin
> Assignee: Justin Bertram
> Priority: Major
> Attachments: backup_artemis.log, primary_artemis.log
>
> Time Spent: 2h 10m
> Remaining Estimate: 0h
>
> 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.
> h2. Steps to Reproduce the Error
> 1. Create primary broker
> {noformat}
> 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{noformat}
> 2. Create backup broker
> {noformat}
> 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{noformat}
> 3. Start brokers
> 4. Add test addresses to primary {{broker.xml}}:
> {code:xml}
> <address name="TEST.IN">
> <anycast>
> <queue name="TEST.IN"/>
> </anycast>
> </address>
> <address name="TEST.OUT">
> <anycast>
> <queue name="TEST.OUT"/>
> </anycast>
> </address>{code}
> 5. Add divert with transformer to primary broker.xml
> {code: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>{code}
> h2. Result
> - an {{IndexOutOfBoundsException}} error will appear in the backup logs,
> e.g.:
> {noformat}
> 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]{noformat}
> - 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
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact