javasessionweblogicweblogic12cthread-priority

How to make WebLogic Session Timeout More Consistent


I am using WebLogic 12c and have to implement a feature that kills the session when the browser closes. I have a "heartbeat" from the client that makes a network call every set number of seconds. Weblogic is configured to time the session out after 3 missed heart beats. This works great for the most part.. Unless you're watching the logs.

So something interesting I found is that WebLogic isn't actually timing the session out at the specified timeout. I have a session listener in place to log when the user is actually logged out and to handle some other logout functionality. What I have observed is those log messages aren't occurring exactly at that timeout time. Instead WebLogic appears to be "randomly" deciding when to clear out dead sessions. The good thing is that if a client attempts to reconnect using the same credentials, WebLogic will see that the session has timed out and trigger the logout functionality. Unfortunately, this really isn't going to work for me. At the very least I would need to have some "Maximum time" before WebLogic would decide to clear out dead sessions.

I feel like this problem is similar to Garbage Collection in Java. It kind of happens when ever it feels like happening.

So, in short, my question is: Is there a way to either prioritize the session cleanout thread in WebLogic, or is there a way to configure WebLogic to fire the session cleanout thread every X number of seconds?


Solution

  • WebLogic uses a second parameter named "invalidation-interval-secs" to configure when the http session object is really cleared. The documentation says :

    Sets the time, in seconds, that WebLogic Server waits between doing house-cleaning checks for timed-out and invalid sessions, and deleting the old sessions and freeing up memory. Use this element to tune WebLogic Server for best performance on high traffic sites. The default value is 60 seconds.

    https://docs.oracle.com/cd/E11035_01/wls100/webapp/weblogic_xml.html