Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 6.6.0
    • Fix Version/s: 6.8.0, 1.5.11, 7.0.0
    • Component/s: wicket
    • Labels:
      None

      Description

      PageRenderer#getSessionId() should check for existence of a Session, otherwise session could creates multiple types.
      For example if we mount home page, and starts an app, it will creates session 2 times, because of redirect, I think.

      1. multiple_session.zip
        48 kB
        Michael Zhavzharov
      2. multiple_session_wicket_670.zip
        45 kB
        Michael Zhavzharov

        Activity

        Hide
        Sven Meier added a comment -

        Master is updated too now. To repeat my explanation:

        In the quickstart there is no bound session.

        PageRenderer just checks whether there is a buffered response lingering around, but it isn't.
        Note the warning logged in that case:

        logger.warn("The Buffered response should be handled by BufferedResponseRequestHandler");

        Sven

        Show
        Sven Meier added a comment - Master is updated too now. To repeat my explanation: In the quickstart there is no bound session. PageRenderer just checks whether there is a buffered response lingering around, but it isn't. Note the warning logged in that case: logger.warn("The Buffered response should be handled by BufferedResponseRequestHandler"); Sven
        Hide
        Martin Grigorov added a comment -

        Any reason why master branch has not be updated with this improvement ?

        (I still have doubts in the improvement though).

        Show
        Martin Grigorov added a comment - Any reason why master branch has not be updated with this improvement ? (I still have doubts in the improvement though).
        Hide
        Sven Meier added a comment -

        Session existence is now checked.

        Show
        Sven Meier added a comment - Session existence is now checked.
        Hide
        Sven Meier added a comment -

        I've change PageRenderer to check for the existence of the session. This will spare you the creation of one Session before a redirect.

        Apart from that it's quite normal for Wicket to create temporary sessions. You should restructure your application to make the creation of a session a cheap operation.

        Show
        Sven Meier added a comment - I've change PageRenderer to check for the existence of the session. This will spare you the creation of one Session before a redirect. Apart from that it's quite normal for Wicket to create temporary sessions. You should restructure your application to make the creation of a session a cheap operation.
        Hide
        Michael Zhavzharov added a comment -

        Also, maybe that I use Glassfish 3.0.1 as a server can cause such problems. Or I missing something else?

        Show
        Michael Zhavzharov added a comment - Also, maybe that I use Glassfish 3.0.1 as a server can cause such problems. Or I missing something else?
        Hide
        Michael Zhavzharov added a comment -

        Sorry for my mistakes.
        Now I created QuickStart with wicket 6.7.0, and make HomePage statefull, but problem is the same. When page loads, session creates 2 times.
        StackTrace is different then previous:
        1)com.alee.WicketApplication.newSession(WicketApplication.java:38)
        2)org.apache.wicket.Application.fetchCreateAndSetSession(Application.java:1557)
        3)org.apache.wicket.Session.get(Session.java:168)
        4)org.apache.wicket.request.handler.render.PageRenderer.getSessionId(PageRenderer.java:101)
        5)org.apache.wicket.request.handler.render.WebPageRenderer.getAndRemoveBufferedResponse(WebPageRenderer.java:79)
        6)org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:168)
        7)org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)
        8)org.apache.wicket.request.cycle.RequestCycle

        Show
        Michael Zhavzharov added a comment - Sorry for my mistakes. Now I created QuickStart with wicket 6.7.0, and make HomePage statefull, but problem is the same. When page loads, session creates 2 times. StackTrace is different then previous: 1)com.alee.WicketApplication.newSession(WicketApplication.java:38) 2)org.apache.wicket.Application.fetchCreateAndSetSession(Application.java:1557) 3)org.apache.wicket.Session.get(Session.java:168) 4)org.apache.wicket.request.handler.render.PageRenderer.getSessionId(PageRenderer.java:101) 5)org.apache.wicket.request.handler.render.WebPageRenderer.getAndRemoveBufferedResponse(WebPageRenderer.java:79) 6)org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:168) 7)org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165) 8)org.apache.wicket.request.cycle.RequestCycle
        Hide
        Andrea Del Bene added a comment - - edited

        In addition your home page is stateless and this kind of page creates a temporary session each time is requested (if user doesn't already own a permanent session).

        Show
        Andrea Del Bene added a comment - - edited In addition your home page is stateless and this kind of page creates a temporary session each time is requested (if user doesn't already own a permanent session).
        Hide
        Sven Meier added a comment -

        Your quickstart runs with Wicket 6.0.0, in that version an unnecessary temporary Session was created by the intercept request mapper. This was mitigated with Wicket 6.6.0.

        Additionally each redirect causes a new temporary session to be created.

        Show
        Sven Meier added a comment - Your quickstart runs with Wicket 6.0.0, in that version an unnecessary temporary Session was created by the intercept request mapper. This was mitigated with Wicket 6.6.0. Additionally each redirect causes a new temporary session to be created.
        Hide
        Michael Zhavzharov added a comment -

        When I created a quickstart, the StackTrace of app.newSession() method, have changed and do not calls getSessionId() method now.
        Now for all session creation it is:
        1)com.alee.WicketApplication.newSession(WicketApplication.java:37)
        2)org.apache.wicket.Application.fetchCreateAndSetSession(Application.java:1557)
        3)org.apache.wicket.Session.get(Session.java:152)
        4)org.apache.wicket.RestartResponseAtInterceptPageException$InterceptData.get(RestartResponseAtInterceptPageException.java:146)
        5)org.apache.wicket.RestartResponseAtInterceptPageException$1.matchedData(RestartResponseAtInterceptPageException.java:211)
        6)org.apache.wicket.RestartResponseAtInterceptPageException$1.getCompatibilityScore(RestartResponseAtInterceptPageException.java:179)
        7)org.apache.wicket.request.mapper.CompoundRequestMapper.mapRequest(CompoundRequestMapper.java:134)
        8)org.apache.wicket.request.cycle.RequestCycle.resolveRequestHandler(RequestCycle.java:182)
        9)org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:207)
        10)org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:281)
        11)org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
        12)org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:245)
        13)org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
        ...

        Show
        Michael Zhavzharov added a comment - When I created a quickstart, the StackTrace of app.newSession() method, have changed and do not calls getSessionId() method now. Now for all session creation it is: 1)com.alee.WicketApplication.newSession(WicketApplication.java:37) 2)org.apache.wicket.Application.fetchCreateAndSetSession(Application.java:1557) 3)org.apache.wicket.Session.get(Session.java:152) 4)org.apache.wicket.RestartResponseAtInterceptPageException$InterceptData.get(RestartResponseAtInterceptPageException.java:146) 5)org.apache.wicket.RestartResponseAtInterceptPageException$1.matchedData(RestartResponseAtInterceptPageException.java:211) 6)org.apache.wicket.RestartResponseAtInterceptPageException$1.getCompatibilityScore(RestartResponseAtInterceptPageException.java:179) 7)org.apache.wicket.request.mapper.CompoundRequestMapper.mapRequest(CompoundRequestMapper.java:134) 8)org.apache.wicket.request.cycle.RequestCycle.resolveRequestHandler(RequestCycle.java:182) 9)org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:207) 10)org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:281) 11)org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188) 12)org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:245) 13)org.apache.catalina.core.ApplicationFilterChain.internalDoFilter ...
        Hide
        Martin Grigorov added a comment -

        Please attach a quickstart.
        #getSessionId() is called when the response is stored (REDIRECT_TO_BUFFER strategy). That means the page is stateful and there must be a bound session.

        Show
        Martin Grigorov added a comment - Please attach a quickstart. #getSessionId() is called when the response is stored (REDIRECT_TO_BUFFER strategy). That means the page is stateful and there must be a bound session.

          People

          • Assignee:
            Sven Meier
            Reporter:
            Michael Zhavzharov
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development