XF 2.1 xf_session_activity is full

developr

Active member
After a few days I get an error xf_session_activity is full and then the forum isn't working.

Maybe because I set the parameter $config['pageCache']['recordSessionActivity'] = true; in config.php?

If I restart MySQL it solve the problem for few days.
 
I increased max_heap_table_size from 32M to 64M but the table is full after a few days and the errors is shown again.

Is there no cron do prune old sessions after a specific time? onlineStatusTimeout is set to 60 minutes.

I found threads with the same problem but without any solution:
 
Last edited:
I created a cronjob to truncate the table if the error is shown.

You have to edit "sitename" and "dbname".

Bash:
#!/bin/bash

cd /var/html/sitename/

if php index.php | grep -q "An error occurred while the page was being generated"
then
    # if the keyword is in the conent
    mysql -e 'truncate dbname.xf_session_activity'
    echo "xf_session_activity is full. truncate table."
fi
 
Why isn't that default solved by XenForo Team it self? I don't want to have the time right now to do some custom changes, for just keeping my site up. Right now I have to truncate the table by hand over phpmyadmin, which feels wrong and a very very dirty workarround for this kinda fundamental problem. Using a cronjob doesn't feel right nor like a undirty solving eighter.. is there nothing which I can acutally change? I mean like it is like having cancer and just treating the pain instead of the main cause of the problem? Or?
 
FWIW I just encountered this on my forum for the first time ever. I've been on Xenforo for almost 6 years now.

This resolved it, even though it appears to have been empty.

MariaDB [(none)]> truncate db_xf.xf_session_activity;

Query OK, 0 rows affected (0.022 sec)
 
I have been truncating the table in phpmyadmin, which sorts out the issue immediately but is not really a solution,

I've also had no problems with xf stability until this one - i'd love to see some sort of fix that doesnt rely on forum users texting me to let me know it's down and time to phpmyadmin again 😭
 
I created a cronjob to truncate the table if the error is shown.

You have to edit "sitename" and "dbname".

Bash:
#!/bin/bash

cd /var/html/sitename/

if php index.php | grep -q "An error occurred while the page was being generated"
then
    # if the keyword is in the conent
    mysql -e 'truncate dbname.xf_session_activity'
    echo "xf_session_activity is full. truncate table."
fi
this sounds good, but i don't see how to implement it (not in the xf admin i assume?)
 
Back
Top Bottom