1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.4 xf_session never removed

Discussion in 'Troubleshooting and Problems' started by UrlJet, Oct 15, 2014.

  1. UrlJet

    UrlJet Member

    Hello,

    Records in the xf_session table on one of our larger XF installs never seems to clean up after itself. We have enabled memcache in the config and it appears to be working but the sessions table never empties.

    Can you please provide some direction if anyone has noticed this before? We searched around quite a bit but can't see where someone has had this specific issue.
     
  2. Mike

    Mike XenForo Developer Staff Member

    If you've enabled Memcache for sessions, then the xf_session table isn't used and won't be touched. It can be emptied manually.
     
  3. UrlJet

    UrlJet Member

    Mike,

    That makes sense. Enabling memcache definitely alters the way sessions are handled but why would xf_session be populated with data even with memcache enabled? The table continues to grow. Please let us know if there is anything else we can check as all the cron entries look good etc.
     
  4. Mike

    Mike XenForo Developer Staff Member

    Well enabling Memcache and using it for sessions are separate configuration settings (https://xenforo.com/help/cache/).

    If the table is getting bigger, then presumably you're not caching sessions. The session table is cleaned up every hour and expired sessions are removed. You can confirm this by looking at the expiry_date column in the table.
     
  5. UrlJet

    UrlJet Member

    Mike-

    Is there some way to tell why the sessions would not be cleaned up? We've verified the cron daily and hourly cleanup jobs are enabled and running.
     
  6. Mike

    Mike XenForo Developer Staff Member

    If the cron is running, then the method is running. Have you confirmed that you have expiry_date values (timestamps) far in the past?
     
  7. Chris D

    Chris D XenForo Developer Staff Member

    Do you have:
    PHP:
    $config['cache']['cacheSessions'] = true;
    Set in config.php?
     
  8. UrlJet

    UrlJet Member

    Hello,

    The variable is not defined by default, we haven't set $config['cache']['cacheSessions'] to true manually , we just enabled memcache as outlined here: https://xenforo.com/help/cache/

    Should we try to force the variable above to false? There's 600,000 entries in the session table since it was manually truncated yesterday. The oldest timestamp is one with timestamp 1413341265 which is when we manually truncated the table. Is there anything else we can check here? We can also revert session cache back to another option for testing.
     
  9. MattW

    MattW Well-Known Member

    You aren't caching your sessions in memcached if you don't have the config value that Chris mentioned previously.
     
  10. UrlJet

    UrlJet Member

    MattW-

    Thanks that makes sense now. The page https://xenforo.com/help/cache/ mentioned this config variable but it wasn't clear if this was set to true if the file cache would be used or just the cache defined in the config.
    Thanks for all of your help!
     

Share This Page