You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2016/04/04 11:09:35 UTC

[Bug 59269] New: Session swapping out in PersistentManagerBase

https://bz.apache.org/bugzilla/show_bug.cgi?id=59269

            Bug ID: 59269
           Summary: Session swapping out in PersistentManagerBase
           Product: Tomcat 9
           Version: 9.0.0.M4
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: johny_walker@centrum.cz

I've been trying to setup PersistentManager, more precisely I wanted to
configure session swapping out to achieve memory friendly configuration under
high load.
To my surprise, this is not possible, or I must be missing something crucial.

Swapping out only works, when the session is idle for too long. However, it
does not work together with the 'maxActiveSessions' configuration option.

Method processMaxActiveSwaps()
------------------------------
In the org.apache.catalina.session.PersistentManagerBase, there is method
called processMaxActiveSwaps(), which should do the 'maxActiveSessions'
checking and swap out superfluous sessions. However, the method body never
executes:

Compare the condition "if (getMaxActiveSessions() >= sessions.length) return;"
with the fact, that exception is thrown if too many sessions are created in
org.apache.catalina.session.ManagerBase.createSession().


I've found this bug in versions 7, 8, 9. Seems that this bug is there since
ages, the same already reported here (in 2001!!!):
https://mail-archives.apache.org/mod_mbox/tomcat-dev/200112.mbox/%3C3C20D8AE.D9B7795F@distributopia.com%3E
https://mail-archives.apache.org/mod_mbox/tomcat-dev/200112.mbox/<3C...@distributopia.com>


Expected behaviour
------------------
Just to eliminate possible misunderstandings, here is what behaviour I expected
from the documentation, the source code and what common sence tells me: there
is configuration option 'maxActiveSessions' which simply limits number of
sessions stored in the memory, to avoid OutOfMemExeption etc. However, I have
session timeout set up for couple of hours (needed) and it is not possible to
keep them all in memory. And I don't even want to tell to my users: Sorry, no
space for you, here you have it: TooManyActiveSessionsException on you. So I'd
like to swap out sessions not active for say half an hour. There is
'minIdleSwap' config option, which tells when the session may be swapped out if
needed. BTW. as this does not work, this option is currently completely
useless.

What can be done: remove the check in
org.apache.catalina.session.ManagerBase.createSession() (or make it less strict
- e.g. allow couple of additional sessions to be created over this limit). Then
the processMaxActiveSwaps() method would do its job nicely and overflowing
sessions would be swapped out.


Many thanks for 1) any clarification if I'm wrong OR 2) bug fixing :-) OR 3)
removing the stale/old/never-more-working source code and documenting that this
feature is simply not there even though it looks like it is.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 59269] Session swapping out in PersistentManagerBase

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59269

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
There is a bug here but I take a slightly different view of the root cause. I'm
of the view that processMaxActiveSwaps() should be aiming to reduce the number
active session below some percentage (e.g. 90%) of maxActive.

minIdleSwap is working correctly but I suspect the Javadoc and the doc could
benefit from some clarification.

I have a patch for the processMaxActiveSwaps() issue ready to commit but I need
to look at the doc issues before I commit it.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 59269] Session swapping out in PersistentManagerBase

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59269

--- Comment #3 from jb <ja...@gmail.com> ---
Thanks for quick fix, I appreciate that.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 59269] Session swapping out in PersistentManagerBase

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59269

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
This has been fixed in:
- 9.0.x for 9.0.0.M5 onwards
- 8.5.x for 8.5.1 onwards
- 8.0.x for 8.0.34 onwards
- 7.0.x for 7.0.69 onwards
- 6.0.x for 6.0.46 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.

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