[jboss-jira] [JBoss JIRA] (WFLY-7280) getSession() Always Creating HttpSession Problem

kin zhu (JIRA) issues at jboss.org
Wed Oct 12 08:16:00 EDT 2016


    [ https://issues.jboss.org/browse/WFLY-7280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13306040#comment-13306040 ] 

kin zhu commented on WFLY-7280:
-------------------------------

I'm sorry for the false alarm.  Turns out that there're two JSESSIONID cookie and firefox  won't  merge them.   The problem solved after I clear the cookies and try login again.

> getSession()  Always Creating HttpSession Problem
> -------------------------------------------------
>
>                 Key: WFLY-7280
>                 URL: https://issues.jboss.org/browse/WFLY-7280
>             Project: WildFly
>          Issue Type: Bug
>          Components: Web (Undertow)
>    Affects Versions: 10.1.0.Final
>         Environment: jdk8u102,  win7x64,  wildfly-servlet-10.1.0.Final.tar.gz
>            Reporter: kin zhu
>            Assignee: Stuart Douglas
>
> I have a login application called cas.war.  I store the captcha code in session. This application has been running smoothly in JBoss7 and Tomcat7. But when I tried to migrate to wildfly10, I found the captcha code will always be null.  I dug a little deeper, and found out that the server is creating new session each time I post a request(the JSESSIONID cookie changes on every request).  I traced the code and pinned down the problem on this location (as of undertow-servlet-1.4.0.Final-sources.jar ) :
> {color:#f6c342}io.undertow.servlet.spec.ServletContextImpl.java,  method  getSession:{color}
> {code:java}
> public HttpSessionImpl getSession(final ServletContextImpl originalServletContext, final HttpServerExchange exchange, boolean create) {
>         SessionConfig c = originalServletContext.getSessionConfig();
>         HttpSessionImpl httpSession = exchange.getAttachment(sessionAttachmentKey);
> {code}
> while  
> sessionAttachmentKey =  {color:#f6c342}io.undertow.util.SimpleAttachmentKey<io.undertow.servlet.spec.HttpSessionImpl>{color}
> 		
> the exchange.attachments map will only contain one such key:   {color:#f6c342}io.undertow.util.SimpleAttachmentKey<io.undertow.server.session.InMemorySessionManager$SessionImpl>{color}
> thus the server will create new session once  request.getSession() is called, regardless one session exist or not.
> And please have a look at the relate class InMemorySessionManager  too.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list