Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 368191

Summary: _maxIdleMs overlaps when bi session times
Product: [RT] Jetty Reporter: Mathieu Carbou <mathieu.carbou>
Component: serverAssignee: Greg Wilkins <gregw>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: jetty-inbox, mathieu.carbou
Version: unspecified   
Target Milestone: 7.5.x   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mathieu Carbou CLA 2012-01-09 14:27:34 EST
Build Identifier: <= 8.1.0.RC2

In web.xml, put a big session time, like 30 days:

<session-timeout>43200</session-timeout>

Breakpoint in class AbstractSession at line 65:

_maxIdleMs=_manager._dftMaxIdleSecs>0?_manager._dftMaxIdleSecs*1000:-1;

_maxIdleMs becomes negative because _dftMaxIdleSecs is an integer with value 2592000 seconds and multiplied with the integer 1000. it overlaps.

The line should be like below (1000L):

_maxIdleMs=_manager._dftMaxIdleSecs>0?_manager._dftMaxIdleSecs*1000L:-1;



Reproducible: Always

Steps to Reproduce:
In web.xml, put a big session time, like 30 days:

<session-timeout>43200</session-timeout>

Breakpoint in class AbstractSession at line 65:

_maxIdleMs=_manager._dftMaxIdleSecs>0?_manager._dftMaxIdleSecs*1000:-1;

_maxIdleMs becomes negative because _dftMaxIdleSecs is an integer with value 2592000 seconds and multiplied with the integer 1000. it overlaps.

The line should be like below (1000L):

_maxIdleMs=_manager._dftMaxIdleSecs>0?_manager._dftMaxIdleSecs*1000L:-1;
Comment 1 Mathieu Carbou CLA 2012-01-09 15:16:39 EST
If you want big session time, you can use subclass AbstractSession and call just after the constructor super.setMaxInactiveInterval to reset the bad values that has been put in maxIdleMs to the good one.

public abstract class SessionSkeleton extends AbstractSession {

        public SessionSkeleton(HttpServletRequest request) {
            super(SessionManagerSkeleton.this, request);
            super.setMaxInactiveInterval(SessionManagerSkeleton.this._dftMaxIdleSecs > 0 ? SessionManagerSkeleton.this._dftMaxIdleSecs : -1);
        }
Comment 2 Greg Wilkins CLA 2012-01-10 20:17:47 EST
thanks.  Will be in 7.6 and 8.1