We have a Wordpress site on a shared server that recently crashed due to running out of disk space, because our MySQL binary logs filled up the drive in a matter of minutes. After reviewing what was in them, we traced it down to a single user in this site that has ~3.4MB being stored in the usermeta table with a meta key of session_tokens. I clicked the Log Out Everywhere option for this user which deleted those records, but then today the same issue started occurring and all of his tokens are back.

Any ideas? I'm not really sure where to begin with this and have no idea how he's amassed this many tokens. I wrote a Wordpress scheduled task that is supposed to delete expired tickets hourly, but since his account had nothing and now today has thousands of them again, the expiration stuff must not apply. I took a peek at some of the expiration timestamps and they are all milliseconds apart, which confirms the scheduled task probably won't help.

  • do you really need to log every single query and its results? Or is this the slow query log? – Tom J Nowell Oct 25 '17 at 21:51
  • @WebElaine - the comment at the bottom of your link is what I used to write the utility to delete any expired tokens, with WP_Session_Tokens::destroy_all_for_all_users(). Problem is, these things aren't expired - they appear to be milliseconds apart, with thousands of them for the same user. @Tom - unfortunately yes, as binary logging is what enables us to do incremental backups instead of full backups every night. – RubyHaus Oct 25 '17 at 22:21

No idea what happened, but the end user was having issues with his computer and somehow it was hanging on to those cookies. Since they weren't expired, nothing we did to remove them did a lot of good but getting the end user to clear cookies/cache resolved the issue.

I'd love to know more about the internals of how Wordpress handles this, but for now at least the issue is gone! I don't think there's anything we could've done inside Wordpress to prevent this though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.