Mantis - Resin
Viewing Issue Advanced Details
5252 minor have not tried 10-22-12 04:01 10-22-12 10:08
harsha  
ferg  
normal  
closed 4.0.31  
fixed  
none    
none 4.0.33  
0005252: NPE during getSession()
We've bumped into a NPE when trying to access the Session for a given request. The relevant section of the stacktrace is given. The simple fix would be to check to see if the request is non-null inside getCookies().

java.lang.NullPointerException
at com.caucho.server.http.HttpServletRequestImpl.getCookies(HttpServletRequestImpl.java:908)
at com.caucho.server.http.HttpServletRequestImpl.findCookie(HttpServletRequestImpl.java:955)
at com.caucho.server.http.HttpServletRequestImpl.getCookie(HttpServletRequestImpl.java:950)
at com.caucho.server.http.HttpServletRequestImpl.findSessionIdFromCookie(HttpServletRequestImpl.java:1019)
at com.caucho.server.http.HttpServletRequestImpl.getRequestedSessionId(HttpServletRequestImpl.java:987)
at com.caucho.server.http.HttpServletRequestImpl.getSessionId(HttpServletRequestImpl.java:1043)
at com.caucho.server.http.AbstractCauchoRequest.createSession(AbstractCauchoRequest.java:684)
at com.caucho.server.http.AbstractCauchoRequest.getSession(AbstractCauchoRequest.java:630)



As an aside, I think this is a race condition due to:

 - The caucho layer tears down a session at some point and an event is fired to let the application layer know of a session tear down.
 - Our application layer has a reaper-thread to detect timed-out sessions.
 - I think the caucho layer has invalidated the session and then fired the session-invalidated event, but we have tried to access that session before we have received that invalidation event.


There are no notes attached to this issue.