Summary: | removeAttribute: Session already invalidated | ||
---|---|---|---|
Product: | Tomcat 5 | Reporter: | Ingolf Knopf <iknopf.bxug-1> |
Component: | Webapps:Manager | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED WONTFIX | ||
Severity: | critical | ||
Priority: | P1 | ||
Version: | 5.0.28 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | other | ||
Attachments: | A patch for tomcat-5.0.28 that works around this issue |
Description
Ingolf Knopf
2004-08-05 11:34:07 UTC
I have similar problem when reloading context (http://issues.apache.org/bugzilla/show_bug.cgi?id=29093). But I have not managed to provide a test case :-( Please provide a test case if possible. I've never had this happen before... Which version of Tomcat are you working with. this happens when the shutdown, the manager tries to write sessions to file, but one of the sessions is in an invalid state. I use Tomcat 5.0.24. I have similar problem while reloading context. There were 200-1000 session when this problem occured. Unfortunately I am not able to provide a test case :-( I think it may be related with session expiration, but I am not sure Sorry, no test case, no bug... The Servlet TCKs test that scenario and there is no failure. Re-open the bug once you have a test case. Thanks -- Jeanfrancois Here is a trace from the jboss deployer which shows why this occurs. This is the equivalent of the tomcat manager undeploying a web app. From within the session writeObject, the non-Serializable attributes are being removed. This in turn causes an invalidation the session as when the removeAttribute calls isValid(), which in turn calls expire: expire():650, org.apache.catalina.session.StandardSession, StandardSession.java isValid():569, org.apache.catalina.session.StandardSession, StandardSession.java removeAttribute():1146, org.apache.catalina.session.StandardSession, StandardSession.java removeAttribute():1122, org.apache.catalina.session.StandardSession, StandardSession.java writeObject():1405, org.apache.catalina.session.StandardSession, StandardSession.java writeObjectData():902, org.apache.catalina.session.StandardSession, StandardSession.java doUnload():539, org.apache.catalina.session.StandardManager, StandardManager.java unload():485, org.apache.catalina.session.StandardManager, StandardManager.java stop():687, org.apache.catalina.session.StandardManager, StandardManager.java stop():4511, org.apache.catalina.core.StandardContext, StandardContext.java destroy():1213, org.apache.catalina.core.ContainerBase, ContainerBase.java destroy():4617, org.apache.catalina.core.StandardContext, StandardContext.java invoke0():-1, sun.reflect.NativeMethodAccessorImpl, NativeMethodAccessorImpl.java invoke():39, sun.reflect.NativeMethodAccessorImpl, NativeMethodAccessorImpl.java invoke():25, sun.reflect.DelegatingMethodAccessorImpl, DelegatingMethodAccessorImpl.java invoke():324, java.lang.reflect.Method, Method.java invoke():503, org.apache.commons.modeler.BaseModelMBean, BaseModelMBean.java invoke():109, org.jboss.mx.server.RawDynamicInvoker, RawDynamicInvoker.java invoke():473, org.jboss.mx.server.MBeanServerImpl, MBeanServerImpl.java performUndeployInternal():436, org.jboss.web.tomcat.tc5.TomcatDeployer, TomcatDeployer.java The isValid() call returns false and the remove of the non-Serializable attribute fails: Caused by: java.lang.IllegalStateException: removeAttribute: Session already invalidated at org.apache.catalina.session.StandardSession.removeAttribute(StandardSession.java:1147) at org.apache.catalina.session.StandardSession.removeAttribute(StandardSession.java:1122) at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1405) at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:902) at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:539) at org.apache.catalina.session.StandardManager.unload(StandardManager.java:485) at org.apache.catalina.session.StandardManager.stop(StandardManager.java:687) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4511) at org.apache.catalina.core.ContainerBase.destroy(ContainerBase.java:1213) at org.apache.catalina.core.StandardContext.destroy(StandardContext.java:4617) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503) These stack traces are from the current jakarta-tomcat-5.0.30 beta source release. Any attempt to serialize an expired session that has non-Serializable attributes will show this problem. One solution would be to not write out invalid sessions from within the StandardManager doUnload() method. Created attachment 17231 [details]
A patch for tomcat-5.0.28 that works around this issue
The workaround doesn't fix the problem of Standard Session. The removeAttribute method calls: isValid() which then expires the session if necessary: if (maxInactiveInterval >= 0) { long timeNow = System.currentTimeMillis(); int timeIdle = (int) ((timeNow - thisAccessedTime) / 1000L); if (timeIdle >= maxInactiveInterval) { expire(true); } } as a result isvalid() returns false and an IllegalStateException is thrown which results in the Context reloading again, but the StandardManager is already in the state stopped which results in an IllegalStateException and the Context starts reloading again and so on Therefore you have to stop the complete server. I don't know the right solution, one may be a different state expired for the StandardSession Note that this is fixed for the 5.5.x branch in 5.5.10 onwards. I am marking this as WONTFIX since the chances of further development on the 5.0.x branch are pretty slim. |