cleanup_sessions() is not invoked, wp_option > 400k _wc_session%
-
WooCommerce 2.3.8, WP 4.2.2, VPS
How to check the bug:
this shows how many outdated sessions are stored:
select count(*) from wp_options where option_name like '_wc_session_exp%' and option_value<UNIX_TIMESTAMP();
this shows the oldest session that should be cleaned (2nd row)
select *,FROM_UNIXTIME(option_value) from wp_options where option_name like '_wc_session_exp%' order by option_value asc limit 10;
let’s get to the guts.
mcedit /wp-content/plugins/woocommerce/includes/class-wc-session-handler.php
and add:
public function debugs($msg){ $f = fopen('/tmp/sheershoff.log','a'); fwrite($f,date(DATE_ATOM).': '.print_r($msg,true)); fwrite($f,'==='."\r\n"); fclose($f); }
and add
$this->debug('constructed');
to the end of__construct
and$this->debug('cleanup_sessions started');
to the start ofcleanup_sessions()
. Installcrontrol
plugin. Try running the cron task with therun now
link. Try rescheduling the task to run soon. Wait. Check the/tmp/sheershoff.log
and see that nocleanup_sessions started
string appears in the file. See that the_wc_session_exp%
count has not decreased.Also, before this bug appeared, I’ve seen a lot of OOMs in my logs, no wonder if we’re trying to store over 200k of session hashes in-memory. Shouldn’t this behavior be corrected?
- The topic ‘cleanup_sessions() is not invoked, wp_option > 400k _wc_session%’ is closed to new replies.