https://issues.apache.org/bugzilla/show_bug.cgi?id=57532

            Bug ID: 57532
           Summary: Session expire message sent to cluster nodes even with
                    DeltaSession configuration not to
           Product: Tomcat 7
           Version: 7.0.42
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: andrew.jard...@jardineworks.com

Hi, - I suppose whether or not this is a bug depends on how you interpret it. I
am using Tomcat 7.0.42 but I have also tried building all the way up to Tomcat
7.0.57 to see if any changes were made but to date nothing has. 

My cluster configuration using the DeltaManager for session replication. I am
using a multi-cast configuration rather than fixed nodes. My manager is
configured as follows --

<Manager className="org.apache.catalina.ha.session.DeltaManager"
                     expireSessionsOnShutdown="false"
                     notifyListenersOnReplication="true"
                />

.. the most important being that I don't want sessions to expire on shutdown.
My interpretation of this is that in a controlled shut down scenario whereby I
initiate a proper shutdown of Node A in an A, B, C cluster, that the server
will be shut down and the sessions on A retained on B and C. This works as
expected for any session that is not marked as Primary on the node that is
being shut down. Primary flagged sessions however are causing a message to be
sent to all nodes in the cluster causing the sessions to be lost. If the server
(process) is killed no sessions are lost. 

I traced this issue back to the following scenario.

In the StandardManager when a shutdown event occurs it is calling a
session.expire(true). Since we have configured the DeltaSession as our
implementation class I logically went there. the expire( boolean ) method in
that class simply makes a call to an overloaded expire( boolean, boolean )
version where the second argument is statically passed as true. The second
argument in the overloaded method is used as a flag to determine whether or not
to notifyCluster.

I forked the project (Tomcat 7.0.57 branch) and update the DeltaSession.expire(
boolean ) method to use the following logic instead --

   /**
     * Perform the internal processing required to invalidate this session,
     * without triggering an exception if the session has already expired.
     *
     * @param notify
     *            Should we notify listeners about the demise of this session?
     */
    @Override
    public void expire(boolean notify) {

        boolean notifyCluster = true;

        if ( manager instanceof DeltaManager ) 
            notifyCluster =
((DeltaManager)manager).isExpireSessionsOnShutdown();


        expire( notify, notifyCluster );

    }

.. which allows me to preserve the same configuration for all Session managers
except the Delta configuration. I built this code and replaced my binaries and
have confirmed that with this logic, session expire is not communicated during
shutdown events to the cluster. 

To me this seems like a defect which is why I am submitting this as an issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to