tomcat-redis-session-manager 异常分析 attempted to load session[] which has been cre

使用tomcat-redis-session-manager 实现session共享后程序后台发现报错如下,并且引起用户投诉。

 

三月 10, 2016 9:56:51 上午 org.apache.catalina.core.StandardHostValve custom
严重: Exception Processing ErrorPage[errorCode=500, location=/error.jsp]
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.IllegalStateException: Race condition encountered: attempted to load session[6AA0605E6A4D496B048463DF6234AEE7] which has been created but not yet serialized.
        at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:488)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
        at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:466)
        at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:337)
        at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:427)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:200)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: javax.servlet.ServletException: java.lang.IllegalStateException: Race condition encountered: attempted to load session[6AA0605E6A4D496B048463DF6234AEE7] which has been created but not yet serialized.
        at org.apache.jsp.error_jsp._jspService(error_jsp.java:157)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
        ... 23 more
Caused by: java.lang.IllegalStateException: Race condition encountered: attempted to load session[6AA0605E6A4D496B048463DF6234AEE7] which has been created but not yet serialized.
        at com.radiadesign.catalina.session.RedisSessionManager.loadSessionFromRedis(RedisSessionManager.java:395)
        at com.radiadesign.catalina.session.RedisSessionManager.findSession(RedisSessionManager.java:321)
        at org.apache.catalina.connector.Request.doGetSession(Request.java:2903)
        at org.apache.catalina.connector.Request.getSession(Request.java:2300)
        at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:897)
        at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229)
        at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:569)
        at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:514)
        at org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:147)
        at org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:126)
        at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:112)
        at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:65)
        at org.apache.jsp.error_jsp._jspService(error_jsp.java:77)
        ... 26 more

 通过sessionID查询redis存储信息发现value为null导致。
产生错误的具体源代码信息如下:

 



 

查看官方(https://github.com/jcoleman/tomcat-redis-session-manager)最新版发现该问题已经被作者发现,但没有解决。
tomcat-redis-session-manager 异常分析 attempted to load session[] which has been cre_第1张图片
 升级到官方最新版后可以解决报错问题,不能解决value值为null的问题。

存在的问题是value值为null的数据没有过期时间会一直存在redis中。

 

你可能感兴趣的:(tomcat-redis-session-manager 异常分析 attempted to load session[] which has been cre)