WordPress.org

Ready to get started?Download WordPress

Forums

Fast Secure Contact Form
[resolved] wp_sessions are not auto removed (11 posts)

  1. Qcybb
    Member
    Posted 1 year ago #

    This plugin is creating wp_sessions in the options table and they are not being auto removed. I've read in another support thread that they were supposed to be auto deleted after 30 mins - which is not happening.

    I've just opened up a new blog which receives 20 visitors a day and already have 600 "wp-session" entries and it's climbing up every day.

    How do I fix this issue?

    http://wordpress.org/extend/plugins/si-contact-form/

  2. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    Finding an answer from the wp sessions author
    http://wordpress.org/support/topic/garbage-collection-not-working

    PS the next version is being returned to PHP sessions

  3. Eric Mann
    Member
    Posted 1 year ago #

    Mike, which version of the WP_Session object did you wrap in to the plugin?

  4. Eric Mann
    Member
    Posted 1 year ago #

    Looking into the code, a couple of things are happening.

    First, the garbage collection routine is registered on the wp hook, which isn't run on the back end unless you're doing a query. So refreshing the dashboard won't do anything.

    Second, the wp_session_garbage_collection hook is scheduled to run twice daily. So while sessions are only valid for a certain period of time (~30 mins, unless you configure it otherwise) they stay in the database until the garbage collector runs.

    You can verify that the scheduled event is in the Cron in a debug environment by:

    1. Setting WP_DEBUG to true
    2. Installing the Debug Bar plugin
    3. Installing Debug Bar Cron

    You should see the wp_session_garbage_collection event in the custom events section as in this screenshot: http://d.pr/i/YPLQ

  5. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    It has version 1.1

  6. Iamhere
    Member
    Posted 1 year ago #

    Hi Mike

    I am also finding tonnes of _wp_session entries in the DB - the DB is getting very bloated. Is there any way to solve this as a fix?

    Thanks

  7. Qcybb
    Member
    Posted 1 year ago #

    Thanks Mike, reverting back to PHP sessions would be great.

    Any rough ETA when this will happen?

  8. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    Maybe a week
    Just have to find the time

  9. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    Eric,

    I still do not think the garbage collection works at all, you might want to check your code again.

    I have 3800 rows of
    _wp_session_[session_id]

    0 rows of
    _wp_session_expires_[session_id]

    The wp_session_cleanup function does nothing because of this.

    I suspect this is why I have been getting support posts like this
    http://wordpress.org/support/topic/vcita-wp_sessions-being-added-to-wp_options-table
    One user found 260,487 sessions in there

  10. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    Update to Version: 3.1.8.2 or higher to fix this.
    The database will be cleaned up also
    I switched back to PHP sessions because WP Sessions had issues with cache plugins.

  11. Eric Mann
    Member
    Posted 1 year ago #

    Just wanted to follow up on this.

    It turns out the portion of code that was registering the timeout window for sessions was lost in version 1.1, so newly created sessions were being created without any sort of timestamp (meaning the garbage collector didn't know what to clean up). This is likely the result of too many people trying to refactor at once, and my inability to keep track of who was removing which function.

    In any case, the bug has been resolved for version 1.1.1 => http://wordpress.org/plugins/wp-session-manager/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic