You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/11/03 23:36:09 UTC

DO NOT REPLY [Bug 24368] New: - Unhandled Exception in PersistentManagerBase.processExpires() kills PersistentManager thread

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24368>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24368

Unhandled Exception in PersistentManagerBase.processExpires() kills PersistentManager thread

           Summary: Unhandled Exception in
                    PersistentManagerBase.processExpires() kills
                    PersistentManager thread
           Product: Tomcat 4
           Version: 4.1.27
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: athieme@zapdata.com


I have seen mention of a similar bug in StandardManager code that was fixed, 
but the cooresponding fix was not made to PersistentManagerBase. In the 
following code, if an Exception occurs while expiring sessions, that Exception 
will kill the PersistentManager thread.

As for a fix, of course, a try/catch around this code will do the trick. 
However, I wonder why this code is not shared between StandardManager and 
PersistentManager?

>From PersistentManagerBase.java:
    protected void processExpires() {

        if (!started)
            return;

        long timeNow = System.currentTimeMillis();
        Session sessions[] = findSessions();

        for (int i = 0; i < sessions.length; i++) {
            StandardSession session = (StandardSession) sessions[i];
            if (!session.isValid())
                continue;
            if (isSessionStale(session, timeNow))
                session.expire();
        }

    }

>From StandardManager.java: (includes try/catch)

    private void processExpires() {

        long timeNow = System.currentTimeMillis();
        Session sessions[] = findSessions();

        for (int i = 0; i < sessions.length; i++) {
            StandardSession session = (StandardSession) sessions[i];
            if (!session.isValid())
                continue;
            int maxInactiveInterval = session.getMaxInactiveInterval();
            if (maxInactiveInterval < 0)
                continue;
            int timeIdle = // Truncate, do not round up
                (int) ((timeNow - session.getLastAccessedTime()) / 1000L);
            if (timeIdle >= maxInactiveInterval) {
                try {
                    expiredSessions++;
                    session.expire();
                } catch (Throwable t) {
                    log(sm.getString("standardManager.expireException"), t);
                }
            }
        }

    }

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