You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Howard Orner (JIRA)" <ji...@apache.org> on 2007/12/03 22:37:26 UTC

[jira] Created: (AMQ-1511) Slave starts connectors before master fails

Slave starts connectors before master fails
-------------------------------------------

                 Key: AMQ-1511
                 URL: https://issues.apache.org/activemq/browse/AMQ-1511
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 4.1.1
            Reporter: Howard Orner


A broker configured as a slave starts its connectors before the the master fails.  This is bad because a) The documentation states that this is not the case.  b) it shouldn't be the case because you don't want clients to be able to connect to the slave until it takes over as master.

In looking at source, it would appear that the MasterConnector of BrokerService is not started until after all the connections are started in startAllConnection().  Unfortunately, to determine if connections should be started, isSlave() is called which relies on the MasterConnector.start() method being called.  

The MasterConnector service start() method needs to be called first before isSlave will work.

See broken code snippet from BrokerService below:


protected void startAllConnectors() throws Exception{
  if (!isSlave()){   // OOPS!!! isSlave asks the MasterConnector if the master is active, but can't until its started 
    ...
       if (services != null) {
                for (int i = 0; i < services.length; i++) {
                    Service service = services[i];   //OOPS, MasterConnector is in this list and the surrounding if relies on it to be started
                    configureService(service);
                    service.start();   //OOPS!!!!   this should have been called for isSlave() to return the right answer.
                }
            }
   }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (AMQ-1511) Slave starts connectors before master fails

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1511?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies reassigned AMQ-1511:
-------------------------------

    Assignee: Rob Davies

> Slave starts connectors before master fails
> -------------------------------------------
>
>                 Key: AMQ-1511
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1511
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 4.1.1
>            Reporter: Howard Orner
>            Assignee: Rob Davies
>
> A broker configured as a slave starts its connectors before the the master fails.  This is bad because a) The documentation states that this is not the case.  b) it shouldn't be the case because you don't want clients to be able to connect to the slave until it takes over as master.
> In looking at source, it would appear that the MasterConnector of BrokerService is not started until after all the connections are started in startAllConnection().  Unfortunately, to determine if connections should be started, isSlave() is called which relies on the MasterConnector.start() method being called.  
> The MasterConnector service start() method needs to be called first before isSlave will work.
> See broken code snippet from BrokerService below:
> protected void startAllConnectors() throws Exception{
>   if (!isSlave()){   // OOPS!!! isSlave asks the MasterConnector if the master is active, but can't until its started 
>     ...
>        if (services != null) {
>                 for (int i = 0; i < services.length; i++) {
>                     Service service = services[i];   //OOPS, MasterConnector is in this list and the surrounding if relies on it to be started
>                     configureService(service);
>                     service.start();   //OOPS!!!!   this should have been called for isSlave() to return the right answer.
>                 }
>             }
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQ-1511) Slave starts connectors before master fails

Posted by "Joe Fernandez (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1511?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joe Fernandez updated AMQ-1511:
-------------------------------

    Attachment: patchfile.txt

Attached is a proposed svn diff patch for this issue. With this patch, a slave broker in a pure master/slave configuration will not open transports, connectors, bridges, proxies, etc. while it is attached to its master. Also, a broker will fail to  start if you configure it to have more than one masterConnector. The code was there to prevent this, but was broken.  

> Slave starts connectors before master fails
> -------------------------------------------
>
>                 Key: AMQ-1511
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1511
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 4.1.1
>            Reporter: Howard Orner
>            Assignee: Rob Davies
>         Attachments: patchfile.txt
>
>
> A broker configured as a slave starts its connectors before the the master fails.  This is bad because a) The documentation states that this is not the case.  b) it shouldn't be the case because you don't want clients to be able to connect to the slave until it takes over as master.
> In looking at source, it would appear that the MasterConnector of BrokerService is not started until after all the connections are started in startAllConnection().  Unfortunately, to determine if connections should be started, isSlave() is called which relies on the MasterConnector.start() method being called.  
> The MasterConnector service start() method needs to be called first before isSlave will work.
> See broken code snippet from BrokerService below:
> protected void startAllConnectors() throws Exception{
>   if (!isSlave()){   // OOPS!!! isSlave asks the MasterConnector if the master is active, but can't until its started 
>     ...
>        if (services != null) {
>                 for (int i = 0; i < services.length; i++) {
>                     Service service = services[i];   //OOPS, MasterConnector is in this list and the surrounding if relies on it to be started
>                     configureService(service);
>                     service.start();   //OOPS!!!!   this should have been called for isSlave() to return the right answer.
>                 }
>             }
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AMQ-1511) Slave starts connectors before master fails

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1511?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies resolved AMQ-1511.
-----------------------------

    Fix Version/s: 5.1.0
       Resolution: Fixed

Patch applied in svn revision 646245

> Slave starts connectors before master fails
> -------------------------------------------
>
>                 Key: AMQ-1511
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1511
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 4.1.1
>            Reporter: Howard Orner
>            Assignee: Rob Davies
>             Fix For: 5.1.0
>
>         Attachments: patchfile.txt
>
>
> A broker configured as a slave starts its connectors before the the master fails.  This is bad because a) The documentation states that this is not the case.  b) it shouldn't be the case because you don't want clients to be able to connect to the slave until it takes over as master.
> In looking at source, it would appear that the MasterConnector of BrokerService is not started until after all the connections are started in startAllConnection().  Unfortunately, to determine if connections should be started, isSlave() is called which relies on the MasterConnector.start() method being called.  
> The MasterConnector service start() method needs to be called first before isSlave will work.
> See broken code snippet from BrokerService below:
> protected void startAllConnectors() throws Exception{
>   if (!isSlave()){   // OOPS!!! isSlave asks the MasterConnector if the master is active, but can't until its started 
>     ...
>        if (services != null) {
>                 for (int i = 0; i < services.length; i++) {
>                     Service service = services[i];   //OOPS, MasterConnector is in this list and the surrounding if relies on it to be started
>                     configureService(service);
>                     service.start();   //OOPS!!!!   this should have been called for isSlave() to return the right answer.
>                 }
>             }
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.