[jboss-jira] [JBoss JIRA] Commented: (JGRP-580) Possible to get the channel into an incorrect and/or inconsistent state
Bela Ban (JIRA)
jira-events at lists.jboss.org
Thu Sep 20 00:11:11 EDT 2007
[ http://jira.jboss.com/jira/browse/JGRP-580?page=comments#action_12377737 ]
Bela Ban commented on JGRP-580:
-------------------------------
A channel cannot get shunned (EXIT) until it is connected. Did you see this in a real program, or are you just exploring the state space and look at all possible states in the Channel's finite state machine ?
> Possible to get the channel into an incorrect and/or inconsistent state
> -----------------------------------------------------------------------
>
> Key: JGRP-580
> URL: http://jira.jboss.com/jira/browse/JGRP-580
> Project: JGroups
> Issue Type: Bug
> Affects Versions: 2.5
> Environment: Windows XP; java 1.5.0_12
> Reporter: Anders Persson
> Assigned To: Bela Ban
> Fix For: 2.6
>
>
> The channel is trying to establish a connection. While trying to create the connection there is a Event.EXIT traversed up the stack. This will close the channel and at the same time release connect(). The problem is that when the thread returns to connect() it will continue as if the connect is continuing successfully. This will result in a channel which is set to be connected even though it is actually closed. This will also cause the auto reconnect to fail since the channel considers itself to be connected.
> After this long description I think that the following snippet of code will provide a better description.
> Today in JChannel the code looks like this:
> public synchronized void connect(String cluster_name) throws ChannelException {
> ...stuff going on...
> Event connect_event = new Event(Event.CONNECT, cluster_name);
> Object res = downcall(connect_event); // waits forever until
> // connected (or channel is
> // closed)
> if (res != null && res instanceof Exception) { // the JOIN was
> // rejected by the
> // coordinator
> throw new ChannelException("connect() failed", (Throwable) res);
> }
> This should be changed to:
> Event connect_event = new Event(Event.CONNECT, cluster_name);
> Object res = downcall(connect_event); // waits forever until
> // connected (or channel is
> // closed)
> /*
> * This is an added section to this method. The if statement will
> * check if the downcall method returned as a result of an
> * Event.EXIT. If so then we should consider this channel to be NOT
> * connected. Otherwise connected will be set to true and any
> * further calls to connect will fail (also auto reconnect will fail
> * for this reason).
> */
> if (!closed) {
> if (res != null && res instanceof Exception) { // the JOIN was
> // rejected by the
> // coordinator
> throw new ChannelException("connect() failed", (Throwable) res);
> }
> It obviously has to be verified that the closed flag is set before calling any stop methods on the protocols.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list