Aleksandr Milovidov created ARTEMIS-5252:
--------------------------------------------

             Summary: Divert with incorrect filter causes startup failure
                 Key: ARTEMIS-5252
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5252
             Project: ActiveMQ Artemis
          Issue Type: Bug
          Components: Broker
    Affects Versions: 2.39.0
         Environment: ActiveMQ Artemis 2.38,0 - 2.39.0 Linux / Windows
            Reporter: Aleksandr Milovidov
         Attachments: artemis_divert_with_incorrect_filter.log

When broker.xml contains a divert with an incorrect filter, ActiveMQ Artemis 
fails to start.

Expected behavior: 
If the divert was created before, keep previous divert settings and start. 
If the divert was absent, skip creating the divert and start.

For example, if invalid filter is specified in the queue configuration, it does 
not lead to a non-operating state of the server. A queue with an incorrect 
filter is not deployed or not changed.

Also when we have a primary-backup cluster with replication, if someone 
accidentally deployed incorrect divert configuration to both servers, it leads 
to unavailability of the entire cluster after restart of the primary server. 
Backup broker tries to become a live server but cannot start because of the 
incorrect configuration.

Steps to reproduce:

1. Create a broker instance. Add to broker.xml:
{code:java}
<addresses>
  <address name="test-source">
    <anycast/>
  </address>
  <address name="test-destination">
    <anycast>
      <queue name="test-destination"/>
    </anycast>
  </address>
</addresses>
<diverts>
  <divert name="divert-test">
    <address>test-source</address>
    <forwarding-address>test-destination</forwarding-address>
    <exclusive>false</exclusive>
    <filter string="key='value'"/>
  </divert>
</diverts>
{code}
2. Change filter string to something incorrect which does not break xml syntax. 
For example {{"(key='value'"}}

When reloading configuration, broker logs an error and continues to work: 
{code:java}
ERROR [org.apache.activemq.artemis.core.server] AMQ224006: Invalid filter: 
(key='value'
ERROR [org.apache.activemq.artemis.core.server] AMQ224069: Change detected in 
broker configuration file, but reload failed
org.apache.activemq.artemis.api.core.ActiveMQInvalidFilterExpressionException: 
AMQ229020: Invalid filter: (key='value'{code}
When restarting the broker, it logs:
{code:java}
ERROR [org.apache.activemq.artemis.core.server] AMQ224006: Invalid filter: 
(key='value'
ERROR [org.apache.activemq.artemis.core.server] AMQ224000: Failure in 
initialisation 
{code}
Full logs are attached: [^artemis_divert_with_incorrect_filter.log]



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