Jeff Mesnil created ACTIVEMQ6-103:
-------------------------------------

             Summary: java.lang.IllegalStateException: channel is closed when 
using JGroups channel
                 Key: ACTIVEMQ6-103
                 URL: https://issues.apache.org/jira/browse/ACTIVEMQ6-103
             Project: ActiveMQ Artemis
          Issue Type: Bug
            Reporter: Jeff Mesnil


use case:
* start a server with replication-master.
* the cluster-connection's discovery-group and the broadcast-group is using the 
same JGroups channel. In WildFly, the JGroups Channel is created by the jgroups 
subsystem and passed to resources (in this case, discovery group and broadcast 
group) that needs it.

When the server starts, there is an IllegalStateException:

11:07:34,912 WARN  [org.apache.activemq.artemis.core.server] (ServerService 
Thread Pool -- 68) AMQ222116: unable to start broadcast group bg-group1: 
java.lang.IllegalStateException: channel is closed
        at org.jgroups.JChannel.checkClosed(JChannel.java:959)
        at org.jgroups.JChannel._preConnect(JChannel.java:548)
        at org.jgroups.JChannel.connect(JChannel.java:288)
        at org.jgroups.JChannel.connect(JChannel.java:279)
        at 
org.apache.activemq.artemis.api.core.JGroupsBroadcastEndpoint$JChannelWrapper.connect(JGroupsBroadcastEndpoint.java:211)
        at 
org.apache.activemq.artemis.api.core.JGroupsBroadcastEndpoint.internalOpen(JGroupsBroadcastEndpoint.java:115)
        at 
org.apache.activemq.artemis.api.core.JGroupsBroadcastEndpoint.openBroadcaster(JGroupsBroadcastEndpoint.java:101)
        at 
org.apache.activemq.artemis.core.server.cluster.impl.BroadcastGroupImpl.start(BroadcastGroupImpl.java:105)
        at 
org.apache.activemq.artemis.core.server.cluster.ClusterManager.start(ClusterManager.java:288)
        at 
org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.initialisePart2(ActiveMQServerImpl.java:1893)
        at 
org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation.run(SharedNothingLiveActivation.java:104)
        at 
org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:417)
        at 
org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:414)
 
When the server starts its broadcast group, JGroups checks that the channel is 
not closed.
The issue is that the channel was closed before.

In SharedNothingLiveActivation#isNodeIdUsed(), closing the locator will also 
stop the discovery group and close its BroadcastEndpoint.
In JGroupsBroadcastEndpoint.JChannelWrapper#close, the underlying channel is 
closed because refCount is 0.

Afterwards, when the cluster manager will start the broadcast group, the same 
channel will be used but since it has been closed, JGroups will raise the 
IllegalStateException.

Artemis should only close the channel if it created it.

If JGroupsChannelBroadcastEndpoint is used (as it is the case in WildFly), the 
channel is passed to Artemis. Artemis does not *own* it and it is not its 
responsibility to close it (it is handled internally by WildFly's jgroups 
subsystem).





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to