Bug 49170

Summary: Transmission of duplicated session in DeltaManager#handleGET_ALL_SESSIONS.
Product: Tomcat 6 Reporter: Keiichi Fujino <kfujino>
Component: ClusterAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 6.0.26   
Target Milestone: default   
Hardware: All   
OS: All   
Attachments: patch against trunk.

Description Keiichi Fujino 2010-04-22 06:54:01 UTC
Created attachment 25333 [details]
patch against trunk.

Config
<Manager className="org.apache.catalina.ha.session.DeltaManager"
         sendAllSessions="false"
         sendAllSessionsSize="XXXX" />

DeltaManager#handleGET_ALL_SESSIONS is as follows.
=====
...skip...
if (isSendAllSessions()) {
    sendSessions(sender, currentSessions, findSessionTimestamp);
} else {
    // send session at blocks
    int len = currentSessions.length < getSendAllSessionsSize() ? currentSessions.length : getSendAllSessionsSize();        Session[] sendSessions = new Session[len];
    for (int i = 0; i < currentSessions.length; i += getSendAllSessionsSize()) {
        len = i + getSendAllSessionsSize() > currentSessions.length ? currentSessions.length - i : getSendAllSessionsSize();
        System.arraycopy(currentSessions, i, sendSessions, 0, len);
        sendSessions(sender, sendSessions,findSessionTimestamp);
...skip...
    }
...skip...
}

=====

sendSessions maintains previous Session. 

For instance,
currentSessions=[ssA, ssB, ssC, ssD, ssE]
sendAllSessionsSize=3

loop1 : sendSessions=[ssA, ssB, ssC]
loop2 : sendSessions=[ssD, ssE, ssC]

ssC is transmitted two times.
It should be the following. 

loop1 :  sendSessions=[ssA, ssB, ssC]
loop2 : sendSessions=[ssD, ssE]

This problem exists in TC5.5, TC6.0, and TC7.0. 

I made a patch against trunk.

Best Regards.
Comment 1 Keiichi Fujino 2010-04-22 07:08:00 UTC
Fixed in trunk and proposed for 6.0.x and 5.5.x.
Comment 2 Keiichi Fujino 2010-05-10 06:29:36 UTC
This fix applied to 6.0, will be in 6.0.27 onwards.
Comment 3 Keiichi Fujino 2010-05-10 06:30:06 UTC
This fix applied to 5.5, will be in 5.5.30 onwards.