You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2022/11/10 18:09:49 UTC

[activemq-artemis] branch main updated: ARTEMIS-4030 Fix SharedStoreLiveActivation race condition

This is an automated email from the ASF dual-hosted git repository.

jbertram pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new 3a5e4ce363 ARTEMIS-4030 Fix SharedStoreLiveActivation race condition
3a5e4ce363 is described below

commit 3a5e4ce36300573525b96b101b69a0a287e1a8ea
Author: Domenico Francesco Bruscino <br...@apache.org>
AuthorDate: Fri Oct 7 09:09:07 2022 +0200

    ARTEMIS-4030 Fix SharedStoreLiveActivation race condition
    
    DefaultCriticalErrorListener stops the server while SharedStoreLiveActivation
    is initializing it.
---
 .../core/server/impl/SharedStoreLiveActivation.java        | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreLiveActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreLiveActivation.java
index b4e2f2ac73..635b6f317b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreLiveActivation.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreLiveActivation.java
@@ -85,16 +85,18 @@ public final class SharedStoreLiveActivation extends LiveActivation {
          nodeManagerActivateCallback = activeMQServer.getNodeManager().startLiveNode();
          activeMQServer.registerActivateCallback(nodeManagerActivateCallback);
 
-         if (activeMQServer.getState() == ActiveMQServerImpl.SERVER_STATE.STOPPED
+         synchronized (activeMQServer) {
+            if (activeMQServer.getState() == ActiveMQServerImpl.SERVER_STATE.STOPPED
                || activeMQServer.getState() == ActiveMQServerImpl.SERVER_STATE.STOPPING) {
-            return;
-         }
+               return;
+            }
 
-         activeMQServer.initialisePart2(false);
+            activeMQServer.initialisePart2(false);
 
-         activeMQServer.completeActivation(false);
+            activeMQServer.completeActivation(false);
 
-         ActiveMQServerLogger.LOGGER.serverIsLive();
+            ActiveMQServerLogger.LOGGER.serverIsLive();
+         }
       } catch (NodeManagerException nodeManagerException) {
          if (nodeManagerException.getCause() instanceof ClosedChannelException) {
             // this is ok, we are being stopped