Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session which has been created but not yet serialized. #88

Open
lifubang opened this issue Nov 21, 2016 · 6 comments
Open

session which has been created but not yet serialized. #88

lifubang opened this issue Nov 21, 2016 · 6 comments

Comments

@lifubang
Copy link

The page display errors as follows:(and I found the ttl of key 6D0DBD5F3B1945021D6CEB1456F8A1FD in redis is -1, and the value is null. How to fix it?)

HTTP Status 500 - Race condition encountered: attempted to load session[6D0DBD5F3B1945021D6CEB1456F8A1FD] which has been created but not yet serialized.

type Exception report

message Race condition encountered: attempted to load session[6D0DBD5F3B1945021D6CEB1456F8A1FD] which has been created but not yet serialized.

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.lang.IllegalStateException: Race condition encountered: attempted to load session[6D0DBD5F3B1945021D6CEB1456F8A1FD] which has been created but not yet serialized.
com.radiadesign.catalina.session.RedisSessionManager.loadSessionFromRedis(RedisSessionManager.java:389)
com.radiadesign.catalina.session.RedisSessionManager.findSession(RedisSessionManager.java:315)
org.apache.catalina.connector.Request.doGetSession(Request.java:3022)
org.apache.catalina.connector.Request.getSessionInternal(Request.java:2636)
com.radiadesign.catalina.session.RedisSessionHandlerValve.invoke(RedisSessionHandlerValve.java:28)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.69 logs.

Apache Tomcat/7.0.69

@jcoleman
Copy link
Owner

Somehow a client managed to request the session before the request which created it has finished saving it. You may be able to fix the issue by forcibly saving the session before the request which creates the session has finished.

@lifubang
Copy link
Author

lifubang commented Nov 22, 2016

I just write a config element in context.xml, and there were any code about RedisSession in my system.
How to write the code to avoid this error? Please help me, thanks very much.

The context.xml's content:

<!-- The contents of this file will be loaded for each web application -->
<Context>
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->
  <Valve className="com.radiadesign.catalina.session.RedisSessionHandlerValve" />
<Manager className="com.radiadesign.catalina.session.RedisSessionManager"
                   host="*******.com"
                   port="6379"
                   password="*********"
                   database="7"
                   maxInactiveInterval="10800"/>
</Context>

@jcoleman
Copy link
Owner

You can try the SAVE_ON_CHANGE persistence policy as documented in the readme; it looks like I added that feature to help with this issue as the previous versions of the readme referenced manually saving the session but appear not to anymore as discussed here #30

@guojjanjun
Copy link

@lifubang the reqeust from loadrunner?

@lifubang
Copy link
Author

No, just from a normal use in chrome.

@guojjanjun
Copy link

The session must be saved in redis before the request was finished( all data was sent to client)
However, some data maybe was send to client before the request was finished, such as session information in response header.
So the client have update the cookie now before last request was finished,and the next request
was send with the new cookies which not stored in redis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants