Hi, I've download tomcat 4.0.1 and I have the great problem with sessions, when I've uncommented the Session Manager. If I use configuration <Manager className="org.apache.catalina.session.PersistentManager" debug="0" saveOnRestart="true" maxActiveSessions="1000" minIdleSwap="-1" maxIdleSwap="300" maxIdleBackup="-1"> <Store className="org.apache.catalina.session.FileStore"/> </Manager> in server.xml, all active sessions are filled with the old stored values each one minute.
Why? The bug is allowed by stupid implementation of harmless method StandardSession.setId(String id) When somebody has written the method StoreBase.processExpires() he has no idea about problems with creating new session from file, testing its settings and removing the session. It seems to be good idea, but the method StandardSession.load(String) loads the session from file (correct), but it also stores the session to the manager (throw setId(String) method) and than it (only for testing, if the session file have to be removed) stores the session to the manager and replaces the current, active session. So, I've changed three classes from org.apache.catalina.session package : StoreBase - processExpires() is commented due the thread with the same functonality is started by PersistentManagerBase. Other reason is the unsynchronisation and possible "unconsistence", because the StoreBase time to time loads session, which is not stored completely. ManagerBase and StandardSession - adding of the new session is moved from the StandardSession.setId() (may be called also by load() ) to the ManagerBase.createSession() . I know that the moving of the calling add() may be a problem because of the removing the transparent addign to the Manager, but current implementation doesn't work :-((((((( Please test it. All diffs are created against the source distribution of the tomcat-4.0.1 . -- Oto 'tapik' Buchta
556a557,559 > synchronized (sessions) { > add (session); > }
351,357c351,356 < if ((this.id != null) && (manager != null)) < manager.remove(this); < < this.id = id; < < if (manager != null) < manager.add(this); --- > if ((this.id != null) && (manager != null)) { > manager.remove(this); > this.id = id; > manager.add(this); > } else > this.id = id;
350c350 < processExpires(); --- > // processExpires(); This is also in PersistentManageru
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>