Support » Plugin: Clef Two-Factor Authentication » clef_wp_session_garbage_collection mysql crash

  • Resolved Philip Ingram


    Sites were down this morning on a 30GB VPS running a small handful of wp sites that all use clef. I found 23GB!!! of log files out of control /var/logs/mysql and had to find a way to start mysql so I could purge them properly. I did this my moving the log files to another server, starting the mysql service, then moving the files back to purge them via mysql cmd, then ran reset master.

    Once I did this I discovered within seconds the new log file grew to 50mb, then 60mb…and so forth. I purged again and captured a 13mb chunk. Every single line (among thousands) are serialized with ‘clef_wp_session_garbage_collection’ so something is causing this to crazy eventually eating up all my drive space and crashing mysql.

    I have a 3 day cycle on logs but it grows too fast, this safeguard doesn’t help. Any ideas what would cause this?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Finally found the actual table in the log file was the wp_option cron table. Checked cron jobs and sure enough, thousands of clef_wp_session_garbage_collection jobs set at 1hr intervals. Manually deleting cron jobs and will be checking other installs for this problem.

    Just checked site again and confirmed approx 20-30 cron tasks for clef_wp_session_garbage_collection. What would be causing this. Other sites on this same server using clef do not do this.

    Plugin Contributor inthylight


    Greetings Phillip,

    I’m sorry for the troubles. This is not a known issue (i.e., no other reports of this behavior have come through). In order to help figure out the cause, may I ask you to email and include the basics of your server setup:

    which hosting provider and package, database type and version, PHP version, Apache or Nginx, etc.;

    and the WordPress configuration: site URL, list of active plugins, any code modifications in functions.php.

    Also, can you check that site’s wp-config.php to see whether either of the following two constants are set:

    Thanks Laurence. I’ve since moved the site to another server (completely different host) along with an offloaded db server that has 384gb of memory to play with =)

    The cron jobs keep popping up and I have to manually delete them. I am using easyengine with nginx caching (–wpfc option) which is pretty standard across all my servers running Ubuntu 14.04 x64. I believe the db is Maria Mysql.

    I’ll shoot over an email with further details. Thanks for offering to help.

    I suspect something happened during the migration from my dev domain that may be causing this.

    Sorry for the delay, just shot over the email w/ details and a login for you. I’ve narrowed it down to front end page loads while logged in populates 2-3 new clef_wp_session_garbage_collection tasks.

    I have another site running same theme/plugins on that server (also using clef) and it doesn’t have this behavior.

    Plugin Contributor inthylight



    Thank you for the detailed info and access to the server for troubleshooting. I’ve verified the issue: the plugin’s WP cron scheduler is adding excess garbage collection events for Clef 2FA’s session.

    We’ve prepared a beta (download .zip) with the fix, which will be pushed live early next week.

    In the meantime, to install the beta .zip:

    1. copy your existing Clef plugin settings including (i.e., App ID, App Secret, and Override URL)
    2. uninstall the existing plugin
    3. go to Plugins -> Add -> Upload (near the top), and select the .zip; then activate the plugin as usual
    4. at the first screen of the setup wizard, select the “Skip setup, I already have Clef API keys” link (near the bottom); then input your saved settings on the Clef settings page

    If you encounter any issues with the beta, please send me a note at

    Perfect thank you Laurence!

    I am also noticing the same behaviour where there are hourly clef_wp_session_garbage_collection cron jobs being actioned. I am noticing that this is the single cause of 503 maintenance pages being displayed until the resource has finished. Is there a planned update release to stop this happening or should I try the beta version and steps written above?

    Plugin Contributor inthylight



    Hi Tom,

    The fix in the beta mentioned above was pushed live in version 2.5.5 back in June. Can you double-check that you are running the latest version of the plugin?

    I am running 2.6.0 and after checking the logs this morning there is huge number of cron events already for today

    I have just deleted the plugin and from what I can see it is leaving an absolute ton of cron jobs behind. I will delete these and re-install the plugin to see if they appear again or not.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘clef_wp_session_garbage_collection mysql crash’ is closed to new replies.