[ 
https://issues.apache.org/jira/browse/ARTEMIS-5686?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18037468#comment-18037468
 ] 

ASF subversion and git services commented on ARTEMIS-5686:
----------------------------------------------------------

Commit d29ef5d5bff8478d74d2f0b939caa777dcb2139f in activemq-artemis's branch 
refs/heads/main from Justin Bertram
[ https://gitbox.apache.org/repos/asf?p=activemq-artemis.git;h=d29ef5d5bf ]

ARTEMIS-5686 fix retroactive address name parsing

The current retroactive address name parsing uses indexOf which can get
confused when the address name itself uses part of the retroactive
naming convention. This commit fixes that problem by using strictly
position-based logic based on lengths of known Strings.


> There is an exception which occurs because of the setting 
> "retroactive-message-count"
> -------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-5686
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5686
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker, Configuration
>    Affects Versions: 2.42.0
>            Reporter: Olga Kostina
>            Assignee: Justin Bertram
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> If the name of the address starts with {{address}} and there is a 
> retroactive-message-count setting in this address, which value is more than 
> 0, there is an exception when the application is started:
> {noformat}
> java.lang.StringIndexOutOfBoundsException: begin 19, end 18, length 40
>       at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4606)
>       at java.base/java.lang.String.substring(String.java:2709)
>       at 
> org.apache.activemq.artemis.api.core.management.ResourceNames.decomposeRetroactiveResourceAddressName(ResourceNames.java:76)
>       at 
> org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl$1.onChange(PostOfficeImpl.java:582)
>       at 
> org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository.registerListener(HierarchicalObjectRepository.java:331)
>       at 
> org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.registerRepositoryListenerForRetroactiveAddress(PostOfficeImpl.java:594)
>       at 
> org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.internalAddressInfo(PostOfficeImpl.java:566)
>       at 
> org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.addAddressInfo(PostOfficeImpl.java:534)
>       at 
> org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.createRetroactiveResources(PostOfficeImpl.java:611)
>       at 
> org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.internalAddressInfo(PostOfficeImpl.java:563)
>       at 
> org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.addAddressInfo(PostOfficeImpl.java:534)
>       at 
> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.addAddressInfo(ActiveMQServerImpl.java:3980)
>       at 
> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.addOrUpdateAddressInfo(ActiveMQServerImpl.java:3988)
>       at 
> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.deployAddressesFromConfiguration(ActiveMQServerImpl.java:3805)
>       at 
> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.deployReloadableConfigFromConfiguration(ActiveMQServerImpl.java:4786)
>       at 
> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.reloadConfigurationFile(ActiveMQServerImpl.java:4705)
>       at 
> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.lambda$initialisePart1$17(ActiveMQServerImpl.java:3392)
>       at 
> org.apache.activemq.artemis.core.server.reload.ReloadManagerImpl$ReloadRegistry.check(ReloadManagerImpl.java:127)
>       at 
> org.apache.activemq.artemis.core.server.reload.ReloadManagerImpl.tick(ReloadManagerImpl.java:68)
>       at 
> org.apache.activemq.artemis.core.server.reload.ReloadManagerImpl.run(ReloadManagerImpl.java:49)
>       at 
> org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent.runForExecutor(ActiveMQScheduledComponent.java:327)
>       at 
> org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent.lambda$bookedRunForScheduler$3(ActiveMQScheduledComponent.java:334)
>       at 
> org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:59)
>       at 
> org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:32)
>       at 
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:69)
>       at 
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
>       at 
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
>       at 
> org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:120){noformat}
> For this mechanism, Artemis creates additional resources, including the 
> address {{$.artemis.internal.address2.address.retro}}, then it tries to find 
> the original address name in this name and crashes because the address starts 
> with {{address}}.



--
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


Reply via email to