Aaron Steigerwald created ARTEMIS-2923: ------------------------------------------
Summary: Configuration plugins are not serializable and cause replication to fail Key: ARTEMIS-2923 URL: https://issues.apache.org/jira/browse/ARTEMIS-2923 Project: ActiveMQ Artemis Issue Type: Bug Components: Broker Affects Versions: 2.15.0 Reporter: Aaron Steigerwald The org.apache.activemq.artemis.core.config.impl.ConfigurationImpl.copy() method fails to serialize plugin list members containing one or more elements. This can be demonstrated using the examples\features\ha\colocated-failover-scale-down example. In each broker.xml file, change the <ha-policy><shared-store> element to <ha-policy><replication> (also remove the <failover-on-shutdown> element) and add the NotificationActiveMQServerPlugin from [https://activemq.apache.org/components/artemis/documentation/latest/broker-plugins.html:] {noformat} <broker-plugins> <broker-plugin class-name="org.apache.activemq.artemis.core.server.plugin.impl.NotificationActiveMQServerPlugin"> <property key="SEND_CONNECTION_NOTIFICATIONS" value="true" /> <property key="SEND_SESSION_NOTIFICATIONS" value="true" /> </broker-plugin> </broker-plugins>{noformat} The following exception is generated: {noformat} ColocatedFailoverScaleDownExample0-out:2020-09-29 17:22:31,917 WARN [org.apache.activemq.artemis.core.server] AMQ222261: Failed to activate a backup: java.security.PrivilegedActionException: java.io.NotSerializableException: org.apache.activemq.artemis.core.server.plugin.impl.NotificationActiveMQServerPlugin{noformat} Two options exist for fixing this: 1) Implement the Serializable interface in all affected plugin classes. 2) Make all org.apache.activemq.artemis.core.config.impl.ConfigurationImpl plugin list members transient and NOT final, create setters for them, and manually copy the plugin lists after serialization in the org.apache.activemq.artemis.core.config.impl.ConfigurationImpl.copy() method like so: {noformat} // Manually copy all plugins because they have been defined as transient due to many classes in their hierarchy not implementing the Serializable interface. ((ConfigurationImpl) config).setBrokerPlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerPlugins())); ((ConfigurationImpl) config).setBrokerConnectionPlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerConnectionPlugins())); ((ConfigurationImpl) config).setBrokerSessionPlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerSessionPlugins())); ((ConfigurationImpl) config).setBrokerConsumerPlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerConsumerPlugins())); ((ConfigurationImpl) config).setBrokerAddressPlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerAddressPlugins())); ((ConfigurationImpl) config).setBrokerQueuePlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerQueuePlugins())); ((ConfigurationImpl) config).setBrokerBindingPlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerBindingPlugins())); ((ConfigurationImpl) config).setBrokerMessagePlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerMessagePlugins())); ((ConfigurationImpl) config).setBrokerBridgePlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerBridgePlugins())); ((ConfigurationImpl) config).setBrokerCriticalPlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerCriticalPlugins())); ((ConfigurationImpl) config).setBrokerFederationPlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerFederationPlugins())); ((ConfigurationImpl) config).setBrokerResourcePlugins(new CopyOnWriteArrayList<>(ConfigurationImpl.this.getBrokerResourcePlugins())); {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)