Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Session timeout

I should also have added that you should upgrade to the latest jetty-9.4, which is jetty-9.4.6.  From the look of some of those debug statements you're on a slightly older version.

Jan

On 6 September 2017 at 10:55, Jan Bartel <janb@xxxxxxxxxxx> wrote:
John,

As you can see on your log trace, each session contains a timer that expires when the session maxInactiveInterval is reached. When the timer expires, that session is queued for attention by the scavenger.  By default the scavenger thread only runs once every 10mins, so it is timing dependent exactly when the session will be scavenged wrt when the session expires. Note that an expired session that has not yet been scavenged is not able to be used, as you have discovered.  The servlet spec does not stipulate any relationship between when a session expires and when the sessionDestroyed listeners will be called, only that an expired session cannot be used, and that the listener must be called when the session is actually invalidated (expiry and invalidation being 2 different things).

If you want to more aggressively get rid of sessions, you can either invalidate them yourself in code, or you can configure a smaller scavenge interval.  To do that, enable the "sessions" module (java -jar $jetty.home/start.jar --add-to-start=sessions) and configure the jetty.sessionScavengeInterval.seconds property. I don't think we've documented that adequately, so I've opened an issue to improve the doco on this aspect: https://github.com/eclipse/jetty.project/issues/1793

cheers
Jan

On 6 September 2017 at 01:26, John English <john.foreign@xxxxxxxxx> wrote:
On 05/09/2017 18:18, John English wrote:
Later tests showed that a second request made between 5 and 10 minutes
later also triggers sessionDestroyed(), and that a request is needed to
trigger the call to sessionDestroyed() if the DEBUG flag is not turned
on; with no DEBUG parameter and no subsequent request,
sessionDestroyed() is never called.

Correction: with a 5 minute timeout and no DEBUG flag, sessionDestroyed() gets called automatically after TWENTY minutes!

--
John English
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
Expert assistance from the creators of Jetty and CometD




--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
Expert assistance from the creators of Jetty and CometD


Back to the top