PDA

View Full Version : session corruption in Resin 3.0.24


mmccuiston
09-29-2009, 07:42 PM
I have users reporting that they are frequently logged out of there session. I have noticed several different exceptions in stdout that all relate to malformed session data.

Example 1)
[14:23:59.111] com.caucho.log.EnvironmentLogger.log java.io.StreamCorruptedException: invalid stream header: 65547970
[14:23:59.111] at java.io.ObjectInputStream.readStreamHeader(ObjectI nputStream.java:783)
[14:23:59.111] at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
[14:23:59.111] at com.caucho.server.cluster.ClusterObject$Distribute dObjectInputStream.<init>(ClusterObject.java:474)
[14:23:59.111] at com.caucho.server.cluster.ClusterObject.load(Clust erObject.java:286)
[14:23:59.111] at com.caucho.server.cluster.FileBacking.loadSelf(Fil eBacking.java:318)
[14:23:59.111] at com.caucho.server.cluster.ClusterStore.load(Cluste rStore.java:423)
[14:23:59.111] at com.caucho.server.cluster.ClusterObject.load(Clust erObject.java:259)
[14:23:59.111] at com.caucho.server.session.SessionImpl.load(Session Impl.java:702)
[14:23:59.111] at com.caucho.server.session.SessionManager.getSessio n(SessionManager.java:1278)
[14:23:59.111] at com.caucho.server.connection.AbstractHttpRequest.c reateSession(AbstractHttpRequest.java:1448)
[14:23:59.111] at com.caucho.server.connection.AbstractHttpRequest.g etSession(AbstractHttpRequest.java:1260)

Example 2)
[11:57:27.237] com.caucho.log.EnvironmentLogger.log java.io.UTFDataFormatException
[11:57:27.237] at java.io.ObjectInputStream$BlockDataInputStream.rea dUTFSpan(ObjectInputStream.java:3082)
[11:57:27.237] at java.io.ObjectInputStream$BlockDataInputStream.rea dUTFBody(ObjectInputStream.java:3007)
[11:57:27.237] at java.io.ObjectInputStream$BlockDataInputStream.rea dUTF(ObjectInputStream.java:2820)
[11:57:27.237] at java.io.ObjectInputStream.readString(ObjectInputSt ream.java:1599)
[11:57:27.237] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1320)
[11:57:27.237] at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1947)
[11:57:27.237] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1871)
[11:57:27.237] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[11:57:27.237] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[11:57:27.237] at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1947)
[11:57:27.237] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1871)
[11:57:27.237] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[11:57:27.237] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[11:57:27.237] at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:351)
[11:57:27.237] at com.caucho.server.session.SessionImpl.load(Session Impl.java:898)
[11:57:27.237] at com.caucho.server.session.SessionManager.load(Sess ionManager.java:1482)
[11:57:27.237] at com.caucho.server.cluster.ClusterObject.load(Clust erObject.java:288)
[11:57:27.237] at com.caucho.server.cluster.FileBacking.loadSelf(Fil eBacking.java:318)
[11:57:27.237] at com.caucho.server.cluster.ClusterStore.load(Cluste rStore.java:423)
[11:57:27.237] at com.caucho.server.cluster.ClusterObject.load(Clust erObject.java:259)
[11:57:27.237] at com.caucho.server.session.SessionImpl.load(Session Impl.java:702)
[11:57:27.237] at com.caucho.server.session.SessionManager.getSessio n(SessionManager.java:1278)
[11:57:27.237] at com.caucho.server.connection.AbstractHttpRequest.c reateSession(AbstractHttpRequest.java:1448)
[11:57:27.237] at com.caucho.server.connection.AbstractHttpRequest.g etSession(AbstractHttpRequest.java:1260)
[11:57:27.237] at com.caucho.server.connection.AbstractHttpResponse. writeHeaders(AbstractHttpResponse.java:1564)
[11:57:27.237] at com.caucho.server.connection.ResponseStream.writeH eaders(ResponseStream.java:216)
[11:57:27.237] at com.caucho.server.connection.ResponseStream.writeN ext(ResponseStream.java:403)
[11:57:27.237] at com.caucho.server.connection.ToByteResponseStream. flushByteBuffer(ToByteResponseStream.java:518)
[11:57:27.237] at com.caucho.server.connection.ToByteResponseStream. flushBuffer(ToByteResponseStream.java:424)
[11:57:27.237] at com.caucho.server.connection.ResponseStream.getBuf fer(ResponseStream.java:225)
[11:57:27.237] at com.caucho.db.store.Inode.writeToStream(Inode.java :168)
[11:57:27.237] at com.caucho.db.store.Inode.writeToStream(Inode.java :158)
[11:57:27.237] at com.caucho.server.cache.CacheFilterChain.fillFromC ache(CacheFilterChain.java:506)
[11:57:27.237] at com.caucho.server.cache.CacheFilterChain.useCache( CacheFilterChain.java:279)
[11:57:27.237] at com.caucho.server.cache.CacheFilterChain.doFilter( CacheFilterChain.java:197)
[11:57:27.237] at com.caucho.server.webapp.WebAppFilterChain.doFilte r(WebAppFilterChain.java:173)
[11:57:27.237] at com.caucho.server.dispatch.ServletInvocation.servi ce(ServletInvocation.java:229)
[11:57:27.237] at com.caucho.server.http.HttpRequest.handleRequest(H ttpRequest.java:274)


Example 3)
[14:57:32.926] com.caucho.log.EnvironmentLogger.log java.io.StreamCorruptedException: invalid type code: 65
[14:57:32.926] at java.io.ObjectInputStream.readTypeString(ObjectInp utStream.java:1404)
[14:57:32.926] at java.io.ObjectStreamClass.readNonProxy(ObjectStrea mClass.java:650)
[14:57:32.926] at java.io.ObjectInputStream.readClassDescriptor(Obje ctInputStream.java:809)
[14:57:32.926] at java.io.ObjectInputStream.readNonProxyDesc(ObjectI nputStream.java:1565)
[14:57:32.926] at java.io.ObjectInputStream.readClassDesc(ObjectInpu tStream.java:1496)
[14:57:32.926] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1732)
[14:57:32.926] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[14:57:32.926] at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:1947)
[14:57:32.926] at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:1871)
[14:57:32.926] at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1753)
[14:57:32.926] at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
[14:57:32.926] at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:351)
[14:57:32.926] at com.caucho.server.session.SessionImpl.load(Session Impl.java:898)
[14:57:32.926] at com.caucho.server.session.SessionManager.load(Sess ionManager.java:1482)
[14:57:32.926] at com.caucho.server.cluster.ClusterObject.load(Clust erObject.java:288)
[14:57:32.926] at com.caucho.server.cluster.FileBacking.loadSelf(Fil eBacking.java:318)
[14:57:32.926] at com.caucho.server.cluster.ClusterStore.load(Cluste rStore.java:423)
[14:57:32.926] at com.caucho.server.cluster.ClusterObject.load(Clust erObject.java:259)
[14:57:32.926] at com.caucho.server.session.SessionImpl.load(Session Impl.java:702)
[14:57:32.926] at com.caucho.server.session.SessionManager.getSessio n(SessionManager.java:1278)
[14:57:32.926] at com.caucho.server.connection.AbstractHttpRequest.c reateSession(AbstractHttpRequest.java:1448)
[14:57:32.926] at com.caucho.server.connection.AbstractHttpRequest.g etSession(AbstractHttpRequest.java:1260)
[14:57:32.926] at com.caucho.server.connection.AbstractHttpResponse. writeHeaders(AbstractHttpResponse.java:1564)
[14:57:32.926] at com.caucho.server.connection.ResponseStream.writeH eaders(ResponseStream.java:216)
[14:57:32.926] at com.caucho.server.connection.ResponseStream.writeN ext(ResponseStream.java:403)
[14:57:32.926] at com.caucho.server.connection.ToByteResponseStream. flushByteBuffer(ToByteResponseStream.java:518)
[14:57:32.926] at com.caucho.server.connection.ToByteResponseStream. flushBuffer(ToByteResponseStream.java:424)
[14:57:32.926] at com.caucho.server.connection.ResponseStream.getBuf fer(ResponseStream.java:225)
[14:57:32.926] at com.caucho.db.store.Inode.writeToStream(Inode.java :168)
[14:57:32.926] at com.caucho.db.store.Inode.writeToStream(Inode.java :158)
[14:57:32.926] at com.caucho.server.cache.CacheFilterChain.fillFromC ache(CacheFilterChain.java:506)
[14:57:32.926] at com.caucho.server.cache.CacheFilterChain.useCache( CacheFilterChain.java:279)
[14:57:32.926] at com.caucho.server.cache.CacheFilterChain.doFilter( CacheFilterChain.java:197)
[14:57:32.926] at com.caucho.server.webapp.WebAppFilterChain.doFilte r(WebAppFilterChain.java:173)
[14:57:32.926] at com.caucho.server.dispatch.ServletInvocation.servi ce(ServletInvocation.java:229)
[14:57:32.926] at com.caucho.server.http.HttpRequest.handleRequest(H ttpRequest.java:274)
[14:57:32.926] at com.caucho.server.port.TcpConnection.run(TcpConnec tion.java:514)
[14:57:32.926] at com.caucho.util.ThreadPool.runTasks(ThreadPool.jav a:520)
[14:57:32.926] at com.caucho.util.ThreadPool.run(ThreadPool.java:442 )
[14:57:32.926] at java.lang.Thread.run(Thread.java:619)

Here is how our session store is 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>




Is it possible that there are two threads simultaneously reading/writing the same session? We have noticed that this problem becomes more frequent when the sessions are larger (>2MB). I notice that there was a similar bug (http://bugs.caucho.com/bug_view_advanced_page.php?bug_id=341) that was fixed in 3.0.15. Could this still be an issue? Any help with this issue would be greatly appreciated.

ferg
10-28-2009, 12:08 AM
You may need to use the JDBC store as a workaround.

We've been working on session related issues for the 4.0.2 release, and have found and fixed a number of important low-level session issues (there are still a few open before we can release it.)

scruzloose33
11-05-2009, 12:24 PM
Once these are fixed, do you plan to release them to the 3.0 and 3.1 branches as well?

nam
11-05-2009, 07:28 PM
No, only Resin 4.x will receive the session fixes. The changes required to fix the issue are too involved to backport to Resin 3.0 and 3.1.