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

           Summary: Attributes are lost in newly created DeltaSession
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: PatchAvailable
          Severity: critical
          Priority: P2
         Component: Cluster
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: martin.su...@nam.cz


It seems SessionMessages spread in multicast are processed by all nodes
including sender.

Problem timing:
1) http request received
2) session is created
3) session_created message sent
4) attribute added into session
5) session_created received back
6) new session createde with same session_id and stored into sessions map
replacing original session with attributes
7) http request is done
8) deltarequest sent but for empty session from step 6

My quick fix:

    /**
     * handle receive new session is created at other node (create backup -
primary false)
     * @param msg
     * @param sender
     */
    protected void handleSESSION_CREATED(SessionMessage msg,Member sender) {
    // Bug fix begin
        if (sessions.containsKey(msg.getSessionID())) {
            log.debug("Rejected session_created with duplicit id");
            return;
        }
    // Bug fix end

    counterReceive_EVT_SESSION_CREATED++;
        if (log.isDebugEnabled())
log.debug(sm.getString("deltaManager.receiveMessage.createNewSession",getName(),
msg.getSessionID()));
        DeltaSession session = (DeltaSession) createEmptySession();
        session.setManager(this);
        session.setValid(true);
        session.setPrimarySession(false);
        session.setCreationTime(msg.getTimestamp());
        // use container maxInactiveInterval so that session will expire
correctly in case of primary transfer
        session.setMaxInactiveInterval(getMaxInactiveInterval());
        session.access();
        if(notifySessionListenersOnReplication)
            session.setId(msg.getSessionID());
        else
            session.setIdInternal(msg.getSessionID());
        session.resetDeltaRequest();
        session.endAccess();
    }

My suggested fixes:

1) in sender node drop SessionMessage sent back by network layer
Check worker id in SessionMessage, which is part of session_id.

2) replace SESSION_CREATED functionality by DeltaRequest.
If SessionMessage with DeltaRequest is received with unknown session_id, create
new session.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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