You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2020/02/18 16:28:07 UTC

[tomcat] branch master updated: Disable session persistence by default on StandardManager

This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 81cfd2d  Disable session persistence by default on StandardManager
81cfd2d is described below

commit 81cfd2dc665db684b1fba0de5af4d08102dc50fb
Author: remm <re...@apache.org>
AuthorDate: Tue Feb 18 17:27:48 2020 +0100

    Disable session persistence by default on StandardManager
    
    It can have significant side effects, with numerous large sessions
    across many webapps causing start/stop performance drops. There are more
    robust alternatives in Tomcat, including the persistent manager and
    clustering (delta manager).
    It can be enabled back using context.xml.
---
 TOMCAT-NEXT.txt                                       |  2 --
 conf/context.xml                                      |  4 ++--
 java/org/apache/catalina/session/StandardManager.java |  2 +-
 webapps/docs/changelog.xml                            |  4 ++++
 webapps/docs/config/manager.xml                       | 15 ++++++++-------
 5 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/TOMCAT-NEXT.txt b/TOMCAT-NEXT.txt
index a510693..5751a5b 100644
--- a/TOMCAT-NEXT.txt
+++ b/TOMCAT-NEXT.txt
@@ -47,8 +47,6 @@ New items for 10.0.0.x onwards:
 
  7. Refactor DefaultServlet to use Ranges in parseRanges().
 
- 8. Disable session persistence: StandardManager.pathname defaults to null.
-
 Deferred until 10.0.x:
 
  1.  Remove the ExtensionValidator and associated classes (assuming that the
diff --git a/conf/context.xml b/conf/context.xml
index 4f6fc0c..0a7cfac 100644
--- a/conf/context.xml
+++ b/conf/context.xml
@@ -24,8 +24,8 @@
     <WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
     <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
 
-    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
+    <!-- Uncomment this to enable session persistence across Tomcat restarts -->
     <!--
-    <Manager pathname="" />
+    <Manager pathname="SESSIONS.ser" />
     -->
 </Context>
diff --git a/java/org/apache/catalina/session/StandardManager.java b/java/org/apache/catalina/session/StandardManager.java
index 48ed3b2..d6c7e70 100644
--- a/java/org/apache/catalina/session/StandardManager.java
+++ b/java/org/apache/catalina/session/StandardManager.java
@@ -108,7 +108,7 @@ public class StandardManager extends ManagerBase {
      * temporary working directory provided by our context, available via
      * the <code>jakarta.servlet.context.tempdir</code> context attribute.
      */
-    protected String pathname = "SESSIONS.ser";
+    protected String pathname = null;
 
 
     // ------------------------------------------------------------- Properties
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index d22d40f..ad7b5fd 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -51,6 +51,10 @@
         Refactor <code>HttpServlet.doOptions()</code> to improve performance.
         (markt)
       </scode>
+      <update>
+        Disable StandardManager session persistence by default. It can be
+        enabled back in <code>context.xml</code>. (remm)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Coyote">
diff --git a/webapps/docs/config/manager.xml b/webapps/docs/config/manager.xml
index e067f45..821085e 100644
--- a/webapps/docs/config/manager.xml
+++ b/webapps/docs/config/manager.xml
@@ -116,10 +116,10 @@
         <p>Absolute or relative (to the work directory for this Context)
         pathname of the file in which session state will be preserved
         across application restarts, if possible.  The default is
-        "SESSIONS.ser".<br />See
+        null.<br />See
         <a href="#Persistence_Across_Restarts">Persistence Across Restarts</a>
         for more information. This persistence may be
-        disabled by setting this attribute to an empty string.</p>
+        enabled by setting this attribute to a non empty string.</p>
       </attribute>
 
       <attribute name="processExpiresFrequency" required="false">
@@ -555,15 +555,16 @@
 
   </subsection>
 
-  <subsection name="Disable Session Persistence">
+  <subsection name="Enable Session Persistence">
 
     <p>As documented above, every web application by default has
-    standard manager implementation configured, and it performs session
-    persistence across restarts. To disable this persistence feature, create
+    standard manager implementation configured, which can perform session
+    persistence across restarts. To enable this persistence feature, create
     a <a href="context.html">Context</a> configuration file for your web
-    application and add the following element there:</p>
+    application and add the following element there (in this example,
+    it will save sessions to files named <code>SESSIONS.ser</code>):</p>
 
-    <source><![CDATA[<Manager pathname="" />]]></source>
+    <source><![CDATA[<Manager pathname="SESSIONS.ser" />]]></source>
   </subsection>
 
 </section>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org