PDA

View Full Version : resin session corrupted


mmccuiston
09-30-2009, 02:46 PM
Apparently sessions are being dropped from our app server. It seems as though the session storage is becoming corrupted. I say this because every time my session gets killed I see an exception related to deserializing a session (UTFDataFormatException and StreamCorruptedException). Here is how our sessions are configured.


<persistent-store type="cluster">
<init>
<always-load>true</always-load>
<always-save>true</always-save>
<path>${resin.storage.dir}/sessions</path>
</init>
</persistent-store>



Here are a couple examples of exceptions we have seen.

[12:52:33.044] com.caucho.log.EnvironmentLogger.log java.io.UTFDataFormatException
[12:52:33.044] at java.io.ObjectInputStream$BlockDataInputStream.rea dUTFSpan(ObjectInputStream.java:3082)
[12:52:33.044] at java.io.ObjectInputStream$BlockDataInputStream.rea dUTFBody(ObjectInputStream.java:3007)
[12:52:33.044] at java.io.ObjectInputStream$BlockDataInputStream.rea dUTF(ObjectInputStream.java:2820)
[12:52:33.044] at java.io.ObjectInputStream.readString(ObjectInputSt ream.java:1599)
[12:52:33.044] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1320)
[12:52:33.044] at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1947)
[12:52:33.044] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1871)
[12:52:33.044] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[12:52:33.044] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[12:52:33.044] at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1947)
[12:52:33.044] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1871)
[12:52:33.044] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[12:52:33.044] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[12:52:33.044] at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1947)
[12:52:33.044] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1871)
[12:52:33.044] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[12:52:33.044] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[12:52:33.044] at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:351)
[12:52:33.044] at java.util.ArrayList.readObject(ArrayList.java:593)
[12:52:33.044] at sun.reflect.GeneratedMethodAccessor129.invoke(Unkn own Source)
[12:52:33.044] at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
[12:52:33.044] at java.lang.reflect.Method.invoke(Method.java:597)
[12:52:33.044] at java.io.ObjectStreamClass.invokeReadObject(ObjectS treamClass.java:974)
[12:52:33.044] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1849)
[12:52:33.044] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[12:52:33.044] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[12:52:33.044] at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1947)
[12:52:33.044] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1871)
[12:52:33.044] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[12:52:33.044] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[12:52:33.044] at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:351)
[12:52:33.044] at com.caucho.server.session.SessionImpl.load(Session Impl.java:898)
[12:52:33.044] at com.caucho.server.session.SessionManager.load(Sess ionManager.java:1482)
[12:52:33.044] at com.caucho.server.cluster.ClusterObject.load(Clust erObject.java:288)
[12:52:33.044] at com.caucho.server.cluster.FileBacking.loadSelf(Fil eBacking.java:318)
[12:52:33.044] at com.caucho.server.cluster.ClusterStore.load(Cluste rStore.java:423)
[12:52:33.044] at com.caucho.server.cluster.ClusterObject.load(Clust erObject.java:259)
[12:52:33.044] at com.caucho.server.session.SessionImpl.load(Session Impl.java:702)
[12:52:33.044] at com.caucho.server.session.SessionManager.getSessio n(SessionManager.java:1278)
[12:52:33.044] at com.caucho.server.connection.AbstractHttpRequest.c reateSession(AbstractHttpRequest.java:1448)
[12:52:33.044] at com.caucho.server.connection.AbstractHttpRequest.g etSession(AbstractHttpRequest.java:1260)



[14:04:42.064] com.caucho.log.EnvironmentLogger.log java.io.StreamCorruptedException: invalid type code: 20
[14:04:42.064] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1356)
[14:04:42.064] at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1947)
[14:04:42.064] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1871)
[14:04:42.064] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[14:04:42.064] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[14:04:42.064] at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1947)
[14:04:42.064] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1871)
[14:04:42.064] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[14:04:42.064] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[14:04:42.064] at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1947)
[14:04:42.064] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1871)
[14:04:42.064] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[14:04:42.064] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[14:04:42.064] at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:351)
[14:04:42.064] at java.util.ArrayList.readObject(ArrayList.java:593)
[14:04:42.064] at sun.reflect.GeneratedMethodAccessor129.invoke(Unkn own Source)
[14:04:42.064] at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
[14:04:42.064] at java.lang.reflect.Method.invoke(Method.java:597)
[14:04:42.064] at java.io.ObjectStreamClass.invokeReadObject(ObjectS treamClass.java:974)
[14:04:42.064] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1849)
[14:04:42.064] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[14:04:42.064] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[14:04:42.064] at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1947)
[14:04:42.064] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1871)
[14:04:42.064] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[14:04:42.064] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[14:04:42.064] at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:351)
[14:04:42.064] at com.caucho.server.session.SessionImpl.load(Session Impl.java:898)
[14:04:42.064] at com.caucho.server.session.SessionManager.load(Sess ionManager.java:1482)
[14:04:42.064] at com.caucho.server.cluster.ClusterObject.load(Clust erObject.java:288)
[14:04:42.064] at com.caucho.server.cluster.FileBacking.loadSelf(Fil eBacking.java:318)
[14:04:42.064] at com.caucho.server.cluster.ClusterStore.load(Cluste rStore.java:423)
[14:04:42.064] at com.caucho.server.cluster.ClusterObject.load(Clust erObject.java:259)
[14:04:42.064] at com.caucho.server.session.SessionImpl.load(Session Impl.java:702)
[14:04:42.064] at com.caucho.server.session.SessionManager.getSessio n(SessionManager.java:1278)
[14:04:42.064] at com.caucho.server.connection.AbstractHttpRequest.c reateSession(AbstractHttpRequest.java:1448)
[14:04:42.064] at com.caucho.server.connection.AbstractHttpRequest.g etSession(AbstractHttpRequest.java:1260)
[14:04:42.064] at com.caucho.server.connection.AbstractHttpResponse. writeHeaders(AbstractHttpResponse.java:1564)
[14:04:42.064] at com.caucho.server.connection.ResponseStream.writeH eaders(ResponseStream.java:216)
[14:04:42.064] at com.caucho.server.connection.ResponseStream.writeN ext(ResponseStream.java:401)
[14:04:42.064] at com.caucho.server.connection.ToByteResponseStream. flushByteBuffer(ToByteResponseStream.java:518)
[14:04:42.064] at com.caucho.server.connection.ToByteResponseStream. flushBuffer(ToByteResponseStream.java:424)
[14:04:42.064] at com.caucho.server.connection.ResponseStream.finish (ResponseStream.java:664)
[14:04:42.064] at com.caucho.server.connection.ResponseStream.close( ResponseStream.java:796)
[14:04:42.064] at com.caucho.server.connection.AbstractHttpResponse. finish(AbstractHttpResponse.java:1964)
[14:04:42.064] at com.caucho.server.connection.AbstractHttpResponse. close(AbstractHttpResponse.java:260)
[14:04:42.064] at com.caucho.server.webapp.WebAppFilterChain.doFilte r(WebAppFilterChain.java:190)
[14:04:42.064] at com.caucho.server.dispatch.ServletInvocation.servi ce(ServletInvocation.java:229)
[14:04:42.064] at com.caucho.server.http.HttpRequest.handleRequest(H ttpRequest.java:274)
[14:04:42.064] at com.caucho.server.port.TcpConnection.run(TcpConnec tion.java:514)
[14:04:42.064] at com.caucho.util.ThreadPool.runTasks(ThreadPool.jav a:520)
[14:04:42.064] at com.caucho.util.ThreadPool.run(ThreadPool.java:442 )
[14:04:42.064] at java.lang.Thread.run(Thread.java:619)

Is it possible that two threads are reading/writing the same session from storage? This is the only possible scenario I can think of that would cause this. We are using Resin Professional 3.0.24 with Java 1.6.0_05. I noticed a similar bug filed some time back, but was marked as fixed. I'm not sure if this is related or not. (http://bugs.caucho.com/bug_view_advanced_page.php?bug_id=341) Any help would be greatly appreciated!

ferg
10-13-2009, 02:25 PM
This is an issue we're working on for Resin 4.0. For Resin 3.1, you may want to switch to jdbc sessions as a workaround.