Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-7990

Even if the session is already created, HttpSession.isNew() returns true

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • TBD EAP 5
    • EAP_EWP 5.1.2
    • Web
    • None
    • jbossweb-2.1.12

    • Hide

      I created the patch[1] to make this issue reproduces notably. This patch sleeps for 10 seconds, before set the false to the isNew.

      1. Start EAP 5.1.2 server and deploy TestApp.war.
      2. Execute following URL in your a web browser.
      http://localhost:8080/TestApp/TestServlet

      3. You can confirm isNew=true in following output.
      09:50:13,765 INFO [STDOUT] – doPost : start
      09:50:13,766 INFO [STDOUT] ---- isNew : true
      09:50:13,766 INFO [STDOUT] – doPost : end

      4. Execute same URL in your a browser.
      5. You can confirm isNew=false in following output.
      09:52:24,624 INFO [STDOUT] – doPost : start
      09:52:24,624 INFO [STDOUT] ---- isNew : false
      09:52:24,624 INFO [STDOUT] – doPost : end

      6. Stop EAP server.
      7. Put the test_patch.jar on JBOSS_HOME/<servername>/lib.
      8. Start EAP server.
      9. Execute following URL in your a browser.
      http://localhost:8080/TestApp/TestServlet

      10. You can confirm isNew=true in following output.
      10:08:57,031 INFO [STDOUT] – doPost : start
      10:08:57,031 INFO [STDOUT] ---- isNew : true
      10:08:57,031 INFO [STDOUT] – doPost : end
      10:08:57,032 INFO [STDOUT] ** endAccess start

      11. Execute same URL in your a browser.
      12. You can confirm even if the session is already created, isNew=true in following output.
      10:08:57,035 INFO [STDOUT] – doPost : start
      10:08:57,035 INFO [STDOUT] ---- isNew : true
      10:08:57,035 INFO [STDOUT] ------ id : 9E8B500B37541D6627C69B37761D54ED
      10:08:57,036 INFO [STDOUT] ------ getId() : 9E8B500B37541D6627C69B37761D54ED
      10:08:57,036 INFO [STDOUT] – doPost : end
      10:08:57,036 INFO [STDOUT] ** endAccess start
      10:09:07,032 INFO [STDOUT] ** endAccess end
      10:09:07,037 INFO [STDOUT] ** endAccess end

      Note.
      This issue may be unable to be confirmed when keep-alive of a browser is the true.
      Please set the false to keep-alive of a browser or confirm this issue by JMete.
      I uploaded TestPlan01.jmx for testing by JMete to this JIRA.

      [1] test_patch.jar
      org.apache.catalina.session.StandardSession.java
      public void endAccess() {
      + System.out.println("** endAccess start");
      + try

      { + Thread.sleep(10000L); + }

      catch (InterruptedException e)

      { + e.printStackTrace(); + }

      isNew = false;
      + System.out.println("** endAccess end");
      if (ACTIVITY_CHECK)

      { accessCount.decrementAndGet(); }

      }

      Show
      I created the patch [1] to make this issue reproduces notably. This patch sleeps for 10 seconds, before set the false to the isNew. 1. Start EAP 5.1.2 server and deploy TestApp.war. 2. Execute following URL in your a web browser. http://localhost:8080/TestApp/TestServlet 3. You can confirm isNew=true in following output. 09:50:13,765 INFO [STDOUT] – doPost : start 09:50:13,766 INFO [STDOUT] ---- isNew : true 09:50:13,766 INFO [STDOUT] – doPost : end 4. Execute same URL in your a browser. 5. You can confirm isNew=false in following output. 09:52:24,624 INFO [STDOUT] – doPost : start 09:52:24,624 INFO [STDOUT] ---- isNew : false 09:52:24,624 INFO [STDOUT] – doPost : end 6. Stop EAP server. 7. Put the test_patch.jar on JBOSS_HOME/<servername>/lib. 8. Start EAP server. 9. Execute following URL in your a browser. http://localhost:8080/TestApp/TestServlet 10. You can confirm isNew=true in following output. 10:08:57,031 INFO [STDOUT] – doPost : start 10:08:57,031 INFO [STDOUT] ---- isNew : true 10:08:57,031 INFO [STDOUT] – doPost : end 10:08:57,032 INFO [STDOUT] ** endAccess start 11. Execute same URL in your a browser. 12. You can confirm even if the session is already created, isNew=true in following output. 10:08:57,035 INFO [STDOUT] – doPost : start 10:08:57,035 INFO [STDOUT] ---- isNew : true 10:08:57,035 INFO [STDOUT] ------ id : 9E8B500B37541D6627C69B37761D54ED 10:08:57,036 INFO [STDOUT] ------ getId() : 9E8B500B37541D6627C69B37761D54ED 10:08:57,036 INFO [STDOUT] – doPost : end 10:08:57,036 INFO [STDOUT] ** endAccess start 10:09:07,032 INFO [STDOUT] ** endAccess end 10:09:07,037 INFO [STDOUT] ** endAccess end Note. This issue may be unable to be confirmed when keep-alive of a browser is the true. Please set the false to keep-alive of a browser or confirm this issue by JMete. I uploaded TestPlan01.jmx for testing by JMete to this JIRA. [1] test_patch.jar org.apache.catalina.session.StandardSession.java public void endAccess() { + System.out.println("** endAccess start"); + try { + Thread.sleep(10000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } isNew = false; + System.out.println("** endAccess end"); if (ACTIVITY_CHECK) { accessCount.decrementAndGet(); } }
    • Hide
      The session remains new while the request processing is in progress, so the issue is irrelevant, since you don't know how long the request is going to take. It is possible the client browser sees the request as complete while the servlet is still processing things, which means the session flag will be switched much later.

      As a result, I won't attempt to do anything with this issue, switching the flag as part of the request recycling is fully legitimate. Please don't reopen this jira.
      Show
      The session remains new while the request processing is in progress, so the issue is irrelevant, since you don't know how long the request is going to take. It is possible the client browser sees the request as complete while the servlet is still processing things, which means the session flag will be switched much later. As a result, I won't attempt to do anything with this issue, switching the flag as part of the request recycling is fully legitimate. Please don't reopen this jira.
    • NEW

      This issue occurs under high-load test. Even if the session is already created, HttpSession.isNew() returns the true.
      The isNew is set as the false by StandardSession.endAccess()[1] and this method is called after OutputBuffer closed.
      I think that set the false to the isNew should be called before OutputBuffer closed.

      [1] org.apache.catalina.session.StandardSession.java
      http://repository.jboss.org/jboss/web/2.1.12.GA-patch-01-brew/src/
      630: /**
      631: * End the access.
      632: */
      633 public void endAccess() {
      634:
      635: isNew = false;
      636:
      637: if (ACTIVITY_CHECK)

      { 638: accessCount.decrementAndGet(); 639: }

      640:
      641: }

        1. TestPlan01.jmx
          4 kB
        2. TestApp.war
          3 kB
        3. test_patch.jar
          23 kB

              sjmenden_jira Samuel Mendenhall (Inactive)
              rhn-support-enagai Eiichi Nagai (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: