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 2018/03/09 12:03:25 UTC

[Bug 62168] New: PersistentManager.minIdleSwap=-1 does not disable swapping as documented.

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

            Bug ID: 62168
           Summary: PersistentManager.minIdleSwap=-1 does not disable
                    swapping as documented.
           Product: Tomcat 9
           Version: 9.0.5
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: holger.sunke@bodo-peters.de
  Target Milestone: -----

Created attachment 35758
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35758&action=edit
Patch against Apache Tomcat trunk r1826332

Hello,

Documentation says:

minIdleSwap     
-----------
The minimum time in seconds a session must be idle before it is eligible to be
swapped to disk to keep the active session count below maxActiveSessions.
Setting to -1 means sessions will not be swapped out to keep the active session
count down. If specified, this value should be less than that specified by
maxIdleSwap. By default, this value is set to -1.


The sentence "Setting to -1 means sessions will not be swapped out to keep the
active session count down." is not true: sessions are swapped when
maxActiveSessions is reached even if minIdleSwap is -1.

The Method
/**
 * Swap idle sessions out to Store if too many are active
*/
org.apache.catalina.session.PersistentManagerBase.processMaxActiveSwaps()

does not consider the minIdleSwap < 0 case, but simply swaps out sessions if
(timeIdle >= minIdleSwap) which behaves just like setting minIdleSwap=0.

This way, the manager likely swaps sessions that are still quite active at that
moment in contrast of the administrators' intention who wantet to disable this
feature.

I suggest attached patch to fix this.

Kind regards

-- 
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 62168] PersistentManager.minIdleSwap=-1 does not disable swapping as documented.

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

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

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

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Thanks for the report and the patch.

Fixed in:
- trunk for 9.0.7 onwards
- 8.5.x for 8.5.30 onwards
- 8.0.x for 8.0.51 onwards
- 7.0.x for 7.0.86 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


[Bug 62168] PersistentManager.minIdleSwap=-1 does not disable swapping as documented.

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

--- Comment #4 from Felix Schumacher <fe...@internetallee.de> ---
Ok, I spoke without looking at the code. I believe you are referring to 

       if ((maxActiveSessions >= 0) &&
                (getActiveSessions() >= maxActiveSessions)) {
            rejectedSessions++;
            throw new TooManyActiveSessionsException(
                    sm.getString("managerBase.createSession.ise"),
                    maxActiveSessions);
        }

in ManagerBase, correct?

But I still believe the old behaviour was not completely wrong, either.

-- 
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 62168] PersistentManager.minIdleSwap=-1 does not disable swapping as documented.

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

Felix Schumacher <fe...@internetallee.de> changed:

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

--- Comment #2 from Felix Schumacher <fe...@internetallee.de> ---
The old behaviour would guard against too many sessions in memory. The new one
could lead to memory overload.

Maybe we should add a warning, if max sessions limit was reached?

-- 
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 62168] PersistentManager.minIdleSwap=-1 does not disable swapping as documented.

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

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

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

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
That is not correct. Look at how maxActiveSessions is used, particularly in
createSession.

-- 
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 62168] PersistentManager.minIdleSwap=-1 does not disable swapping as documented.

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

--- Comment #5 from Mark Thomas <ma...@apache.org> ---
The old behaviour was wrong because it did not differentiate between
minIdleSwap==0 and minIdleSwap==-1

-- 
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