[wp-trac] [WordPress Trac] #17519: With Persistent Caching get_option returns old values of option despite update

WordPress Trac wp-trac at lists.automattic.com
Fri May 20 13:14:30 UTC 2011


#17519: With Persistent Caching get_option returns old values of option despite
update
--------------------------+-----------------------------
 Reporter:  vickybiswas   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 We use wordpress 3.x on different installations for our high traffic
 sites.

 We use persistent caching using W3 Total Cache object cache
 which is set to read from our memcached servers

 Intermittently we noticed
 cron set but not running,
 options set but not returning the right value

 On digging deeper we found that when concurrent pages are loading a race
 condition existed which over wrote the new values with old values.

 Screen shot attached will display what we mean here.
 We created a test page which did the following
 1. read option value from db
 2. dump the object from step 1
 3. get_option
 4. display value received in step 3
 5. update option
 6. get_option
 7. display value received in step 7
 8. read option value from db
 9. dump the object from step 8
 10. Stop
 The output in the screenshot shows that get option was returning a cached
 copy of the option although the db contained a later value.

 '''Way to recreate using above algo'''
 ''Platform''
 WP ver 3.x with W3 Total Cache

 ''Settings''
 W3 Total Cache object caching on
 using memcache servers

 ''Code''

 {{{
 <?php
 print("Starting script <br />");
 require_once("wp-load.php");

 $countNumDB = show_db_values();
 $countNumDB++;

 $countNum = show_go_values();
 if ($countNum==0) update_option("mmc_test_entry_a", 1);

 update_option("mmc_test_entry_a",$countNumDB);

 print("After Update-----------------------------------<br />");

 show_go_values();
 show_db_values();

 sleep(2);


 //Fetch and Display option Value using DB
 function show_db_values() {
   global $wpdb;
   $oRS = $wpdb->get_row("SELECT * FROM wp_options WHERE
 option_name='mmc_test_entry_a'");
   print("<pre>\n");
   print_r($oRS);
   print("</pre><br />\n");
   return intval($oRS->option_value);
 }

 //Fetch and Display option Value using get_option
 function show_go_values() {
   $countNum = intval(get_option("mmc_test_entry_a"));
   print('@ ' . time() . "get_option shows -> {$countNum}<br />");
   return intval($countNum);
 }
 }}}
 Open this page in 4 windows and refresh these page consecutively a few
 times you would notice mismatch in db and fetch values like the second
 screenshot which shows
 the db reflecting 9
 get option fetches 7
 after update both show 10
 but parallely if we open this in another widow we would still get 7 using
 get_option

 We did a similar script for testing cron with similar results
 {{{
 Starting script

 stdClass Object
 (
     [option_id] => 96
     [blog_id] => 0
     [option_name] => cron
     [option_value] =>
 a:16:{i:1299753900;a:1:{s:22:"mmc_astroscopes_update";a:2:{s:32:"0420685dad7e38d8c877822ab455ed11";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";N;s:9:"cache_key";s:42:"mmc_astro_d41d8cd98f00b204e9800998ecf8427e";}}s:32:"f34b1f61fd084a9b3d78351e7603e83e";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:98:"http://solutions.astrology.com/scripts/it.dll?cust_id=afv1x6&doc=daily69momscope/dailymomscope.xml";s:9:"cache_key";s:42:"mmc_astro_6c10ce151460e0cbc2fb83b8fba37a06";}}}}i:1299754740;a:1:{s:13:"kb_rss_update";a:5:{s:32:"d5ab97badfec5d705b3648bd534f0477";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_34a25eb496b7858cb5c826fd809bce48";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-3";}}s:32:"c3116833b112d30c6367be872b4c67d4";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_426548f3f955925809625b9c6b9b1744";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-4";}}s:32:"18b3055792aacef123074b9ca74dac55";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_364c7f478c7121b7bb621aa7fa8403a3";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-5";}}s:32:"5a4a08925ea65721b5a23699ac97773d";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_0306f5e9f102f025bce58c6c822c3be4";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-6";}}s:32:"eaf0bd348c10a2fd06a3acad91b7ee4c";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_2a495aedf333c5736fe131abe87cd0a7";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-7";}}}}i:1299754750;a:1:{s:25:"w3_cdn_cron_queue_process";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:25:"w3_cdn_cron_queue_process";s:4:"args";a:0:{}s:8:"interval";i:900;}}}i:1299759120;a:5:{s:23:"celebritytwitter_update";a:1:{s:32:"6e522efa368959102e2dd6b4f22e1909";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:29:"http://giantredcarpet.com/rss";}}}s:20:"hollywoodlife_update";a:1:{s:32:"5ba39041bb096595e23e3c2119691d00";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:34:"http://www.hollywoodlife.com/feed/";}}}s:20:"entertainment_update";a:1:{s:32:"301d48ec2a9f4b36afdcd220426071ad";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:57:"http://feeds.feedburner.com/cafemom/thestir/entertainment";}}}s:25:"celebritybabyscoop_update";a:1:{s:32:"d6f57fa14ee72b7fdb6e1ee0d8fd72c5";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:41:"http://www.celebritybabyscoop.com/rss.xml";}}}s:10:"TMZ_update"
 ;a:1:{s:32:"5fae3b7313fbde8e0fa9608814e4a60b";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:26:"http://www.tmz.com/rss.xml";}}}}i:1299760706;a:1:{s:19:"wp_scheduled_delete";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:0:{}s:8:"interval";i:86400;}}}i:1299788066;a:1:{s:16:"wp_update_themes";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}}i:1299788076;a:2:{s:16:"wp_version_check";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}s:17:"wp_update_plugins";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}}i:1299839463;a:1:{s:24:"akismet_scheduled_delete";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:0:{}s:8:"interval";i:86400;}}}i:1300356860;a:1:{s:8:
 "do_pings";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:2:{s:8:"schedule";b:0;s:4:"args";a:0:{}}}}i:1300356900;a:1:{s:28:"generate_google_news_sitemap";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:2:{s:8:"schedule";b:0;s:4:"args";a:0:{}}}}i:1305886446;a:1:{s:14:"test_entry_A_1";a:1:{s:32:"6a0516caf3ce51275a89301665b122f0";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_1";}s:8:"interval";i:86400;}}}i:1305887119;a:1:{s:14:"test_entry_A_2";a:1:{s:32:"aa36d3b4b4b434079a14acfb78ee17f7";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_2";}s:8:"interval";i:86400;}}}i:1305887137;a:1:{s:14:"test_entry_A_3";a:1:{s:32:"a27438b84df31de69f5733f8d5158b3b";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_3";}s:8:"interval";i:86400;}}}i:1305887141;a:1:{s:14:"test_entry_A_4";a:1:{s:32:"2111368a27f704830c3a4e2059d14023";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_4";}s:8:"interval";i:86400;}}}i:1305887151;a:1:{s:14:"test_entry_A_5";a:1:{s:32:
 "7aa257bc988cc2f7a581b9dc514aa758";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_5";}s:8:"interval";i:86400;}}}s:7:"version";i:2;}
     [autoload] => yes
 )


 @ 1305872756get_option shows ->
 a:15:{i:1299753900;a:1:{s:22:"mmc_astroscopes_update";a:2:{s:32:"0420685dad7e38d8c877822ab455ed11";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";N;s:9:"cache_key";s:42:"mmc_astro_d41d8cd98f00b204e9800998ecf8427e";}}s:32:"f34b1f61fd084a9b3d78351e7603e83e";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:98:"http://solutions.astrology.com/scripts/it.dll?cust_id=afv1x6&doc=daily69momscope/dailymomscope.xml";s:9:"cache_key";s:42:"mmc_astro_6c10ce151460e0cbc2fb83b8fba37a06";}}}}i:1299754740;a:1:{s:13:"kb_rss_update";a:5:{s:32:"d5ab97badfec5d705b3648bd534f0477";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_34a25eb496b7858cb5c826fd809bce48";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-3";}}s:32:"c3116833b112d30c6367be872b4c67d4";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_426548f3f955925809625b9c6b9b1744";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-4";}}s:32:"18b3055792aacef123074b9ca74dac55";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_364c7f478c7121b7bb621aa7fa8403a3";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-5";}}s:32:"5a4a08925ea65721b5a23699ac97773d";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_0306f5e9f102f025bce58c6c822c3be4";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-6";}}s:32:"eaf0bd348c10a2fd06a3acad91b7ee4c";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_2a495aedf333c5736fe131abe87cd0a7";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-7";}}}}i:1299754750;a:1:{s:25:"w3_cdn_cron_queue_process";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:25:"w3_cdn_cron_queue_process";s:4:"args";a:0:{}s:8:"interval";i:900;}}}i:1299759120;a:5:{s:23:"celebritytwitter_update";a:1:{s:32:"6e522efa368959102e2dd6b4f22e1909";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:29:"http://giantredcarpet.com/rss";}}}s:20:"hollywoodlife_update";a:1:{s:32:"5ba39041bb096595e23e3c2119691d00";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:34:"http://www.hollywoodlife.com/feed/";}}}s:20:"entertainment_update";a:1:{s:32:"301d48ec2a9f4b36afdcd220426071ad";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:57:"http://feeds.feedburner.com/cafemom/thestir/entertainment";}}}s:25:"celebritybabyscoop_update";a:1:{s:32:"d6f57fa14ee72b7fdb6e1ee0d8fd72c5";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:41:"http://www.celebritybabyscoop.com/rss.xml";}}}s:10:"TMZ_update"
 ;a:1:{s:32:"5fae3b7313fbde8e0fa9608814e4a60b";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:26:"http://www.tmz.com/rss.xml";}}}}i:1299760706;a:1:{s:19:"wp_scheduled_delete";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:0:{}s:8:"interval";i:86400;}}}i:1299788066;a:1:{s:16:"wp_update_themes";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}}i:1299788076;a:2:{s:16:"wp_version_check";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}s:17:"wp_update_plugins";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}}i:1299839463;a:1:{s:24:"akismet_scheduled_delete";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:0:{}s:8:"interval";i:86400;}}}i:1300356860;a:1:{s:8:
 "do_pings";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:2:{s:8:"schedule";b:0;s:4:"args";a:0:{}}}}i:1300356900;a:1:{s:28:"generate_google_news_sitemap";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:2:{s:8:"schedule";b:0;s:4:"args";a:0:{}}}}i:1305886446;a:1:{s:14:"test_entry_A_1";a:1:{s:32:"6a0516caf3ce51275a89301665b122f0";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_1";}s:8:"interval";i:86400;}}}i:1305887119;a:1:{s:14:"test_entry_A_2";a:1:{s:32:"aa36d3b4b4b434079a14acfb78ee17f7";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_2";}s:8:"interval";i:86400;}}}i:1305887137;a:1:{s:14:"test_entry_A_3";a:1:{s:32:"a27438b84df31de69f5733f8d5158b3b";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_3";}s:8:"interval";i:86400;}}}i:1305887141;a:1:{s:14:"test_entry_A_4";a:1:{s:32:"2111368a27f704830c3a4e2059d14023";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_4";}s:8:"interval";i:86400;}}}s:7:"version";i:2;}
 After Update-----------------------------------
 @ 1305872757get_option shows ->
 a:16:{i:1299753900;a:1:{s:22:"mmc_astroscopes_update";a:2:{s:32:"0420685dad7e38d8c877822ab455ed11";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";N;s:9:"cache_key";s:42:"mmc_astro_d41d8cd98f00b204e9800998ecf8427e";}}s:32:"f34b1f61fd084a9b3d78351e7603e83e";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:98:"http://solutions.astrology.com/scripts/it.dll?cust_id=afv1x6&doc=daily69momscope/dailymomscope.xml";s:9:"cache_key";s:42:"mmc_astro_6c10ce151460e0cbc2fb83b8fba37a06";}}}}i:1299754740;a:1:{s:13:"kb_rss_update";a:5:{s:32:"d5ab97badfec5d705b3648bd534f0477";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_34a25eb496b7858cb5c826fd809bce48";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-3";}}s:32:"c3116833b112d30c6367be872b4c67d4";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_426548f3f955925809625b9c6b9b1744";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-4";}}s:32:"18b3055792aacef123074b9ca74dac55";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_364c7f478c7121b7bb621aa7fa8403a3";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-5";}}s:32:"5a4a08925ea65721b5a23699ac97773d";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_0306f5e9f102f025bce58c6c822c3be4";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-6";}}s:32:"eaf0bd348c10a2fd06a3acad91b7ee4c";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_2a495aedf333c5736fe131abe87cd0a7";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-7";}}}}i:1299754750;a:1:{s:25:"w3_cdn_cron_queue_process";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:25:"w3_cdn_cron_queue_process";s:4:"args";a:0:{}s:8:"interval";i:900;}}}i:1299759120;a:5:{s:23:"celebritytwitter_update";a:1:{s:32:"6e522efa368959102e2dd6b4f22e1909";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:29:"http://giantredcarpet.com/rss";}}}s:20:"hollywoodlife_update";a:1:{s:32:"5ba39041bb096595e23e3c2119691d00";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:34:"http://www.hollywoodlife.com/feed/";}}}s:20:"entertainment_update";a:1:{s:32:"301d48ec2a9f4b36afdcd220426071ad";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:57:"http://feeds.feedburner.com/cafemom/thestir/entertainment";}}}s:25:"celebritybabyscoop_update";a:1:{s:32:"d6f57fa14ee72b7fdb6e1ee0d8fd72c5";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:41:"http://www.celebritybabyscoop.com/rss.xml";}}}s:10:"TMZ_update"
 ;a:1:{s:32:"5fae3b7313fbde8e0fa9608814e4a60b";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:26:"http://www.tmz.com/rss.xml";}}}}i:1299760706;a:1:{s:19:"wp_scheduled_delete";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:0:{}s:8:"interval";i:86400;}}}i:1299788066;a:1:{s:16:"wp_update_themes";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}}i:1299788076;a:2:{s:16:"wp_version_check";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}s:17:"wp_update_plugins";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}}i:1299839463;a:1:{s:24:"akismet_scheduled_delete";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:0:{}s:8:"interval";i:86400;}}}i:1300356860;a:1:{s:8:
 "do_pings";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:2:{s:8:"schedule";b:0;s:4:"args";a:0:{}}}}i:1300356900;a:1:{s:28:"generate_google_news_sitemap";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:2:{s:8:"schedule";b:0;s:4:"args";a:0:{}}}}i:1305886446;a:1:{s:14:"test_entry_A_1";a:1:{s:32:"6a0516caf3ce51275a89301665b122f0";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_1";}s:8:"interval";i:86400;}}}i:1305887119;a:1:{s:14:"test_entry_A_2";a:1:{s:32:"aa36d3b4b4b434079a14acfb78ee17f7";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_2";}s:8:"interval";i:86400;}}}i:1305887137;a:1:{s:14:"test_entry_A_3";a:1:{s:32:"a27438b84df31de69f5733f8d5158b3b";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_3";}s:8:"interval";i:86400;}}}i:1305887141;a:1:{s:14:"test_entry_A_4";a:1:{s:32:"2111368a27f704830c3a4e2059d14023";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_4";}s:8:"interval";i:86400;}}}i:1305887156;a:1:{s:14:"test_entry_A_6";a:1:{s:32:
 "2c64bb51f72127dffabb04230ee37104";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_6";}s:8:"interval";i:86400;}}}s:7:"version";i:2;}

 stdClass Object
 (
     [option_id] => 96
     [blog_id] => 0
     [option_name] => cron
     [option_value] =>
 a:16:{i:1299753900;a:1:{s:22:"mmc_astroscopes_update";a:2:{s:32:"0420685dad7e38d8c877822ab455ed11";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";N;s:9:"cache_key";s:42:"mmc_astro_d41d8cd98f00b204e9800998ecf8427e";}}s:32:"f34b1f61fd084a9b3d78351e7603e83e";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:98:"http://solutions.astrology.com/scripts/it.dll?cust_id=afv1x6&doc=daily69momscope/dailymomscope.xml";s:9:"cache_key";s:42:"mmc_astro_6c10ce151460e0cbc2fb83b8fba37a06";}}}}i:1299754740;a:1:{s:13:"kb_rss_update";a:5:{s:32:"d5ab97badfec5d705b3648bd534f0477";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_34a25eb496b7858cb5c826fd809bce48";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-3";}}s:32:"c3116833b112d30c6367be872b4c67d4";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_426548f3f955925809625b9c6b9b1744";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-4";}}s:32:"18b3055792aacef123074b9ca74dac55";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_364c7f478c7121b7bb621aa7fa8403a3";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-5";}}s:32:"5a4a08925ea65721b5a23699ac97773d";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_0306f5e9f102f025bce58c6c822c3be4";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-6";}}s:32:"eaf0bd348c10a2fd06a3acad91b7ee4c";a:2:{s:8:"schedule";b:0;s:4:"args";a:2:{s:14:"feed_to_update";s:36:"rss_2a495aedf333c5736fe131abe87cd0a7";s:9:"widget_id";s:17
 :"kb-advanced-
 rss-7";}}}}i:1299754750;a:1:{s:25:"w3_cdn_cron_queue_process";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:25:"w3_cdn_cron_queue_process";s:4:"args";a:0:{}s:8:"interval";i:900;}}}i:1299759120;a:5:{s:23:"celebritytwitter_update";a:1:{s:32:"6e522efa368959102e2dd6b4f22e1909";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:29:"http://giantredcarpet.com/rss";}}}s:20:"hollywoodlife_update";a:1:{s:32:"5ba39041bb096595e23e3c2119691d00";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:34:"http://www.hollywoodlife.com/feed/";}}}s:20:"entertainment_update";a:1:{s:32:"301d48ec2a9f4b36afdcd220426071ad";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:57:"http://feeds.feedburner.com/cafemom/thestir/entertainment";}}}s:25:"celebritybabyscoop_update";a:1:{s:32:"d6f57fa14ee72b7fdb6e1ee0d8fd72c5";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:41:"http://www.celebritybabyscoop.com/rss.xml";}}}s:10:"TMZ_update"
 ;a:1:{s:32:"5fae3b7313fbde8e0fa9608814e4a60b";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{s:14:"feed_to_update";s:26:"http://www.tmz.com/rss.xml";}}}}i:1299760706;a:1:{s:19:"wp_scheduled_delete";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:0:{}s:8:"interval";i:86400;}}}i:1299788066;a:1:{s:16:"wp_update_themes";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}}i:1299788076;a:2:{s:16:"wp_version_check";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}s:17:"wp_update_plugins";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}}i:1299839463;a:1:{s:24:"akismet_scheduled_delete";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:0:{}s:8:"interval";i:86400;}}}i:1300356860;a:1:{s:8:
 "do_pings";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:2:{s:8:"schedule";b:0;s:4:"args";a:0:{}}}}i:1300356900;a:1:{s:28:"generate_google_news_sitemap";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:2:{s:8:"schedule";b:0;s:4:"args";a:0:{}}}}i:1305886446;a:1:{s:14:"test_entry_A_1";a:1:{s:32:"6a0516caf3ce51275a89301665b122f0";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_1";}s:8:"interval";i:86400;}}}i:1305887119;a:1:{s:14:"test_entry_A_2";a:1:{s:32:"aa36d3b4b4b434079a14acfb78ee17f7";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_2";}s:8:"interval";i:86400;}}}i:1305887137;a:1:{s:14:"test_entry_A_3";a:1:{s:32:"a27438b84df31de69f5733f8d5158b3b";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_3";}s:8:"interval";i:86400;}}}i:1305887141;a:1:{s:14:"test_entry_A_4";a:1:{s:32:"2111368a27f704830c3a4e2059d14023";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_4";}s:8:"interval";i:86400;}}}i:1305887156;a:1:{s:14:"test_entry_A_6";a:1:{s:32:
 "2c64bb51f72127dffabb04230ee37104";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:1:{i:0;s:3:"A_6";}s:8:"interval";i:86400;}}}s:7:"version";i:2;}
     [autoload] => yes
 )

 }}}

 If you notice the cron finally contained A_6 and A_5 was lost as if it
 never existed in the cron.

 '''Solution'''
 We used a temporary solution as follows

 {{{
 add_action( 'pre_option_cron', 'mmc_pre_option_cron',10 );
 wp_schedule_event($new_timestamp,$recurrence,$hook,$args);
 remove_action( 'pre_option_cron', 'mmc_pre_option_cron',10 );

 /**
  * Clean Cron Values from cache so that fresh is fetched
  *
  * @since 2011-04-18 Vicky Biswas
  */
 function mmc_pre_option_cron (){
         $alloptions = wp_load_alloptions();
         if ( isset( $alloptions['cron'] ) ) {
             unset ($alloptions['cron']);
             wp_cache_set( 'alloptions', $alloptions, 'options' );
         } else
             wp_cache_delete( 'cron', 'options' );
     return false;
 }
 }}}
 We invalidated the cache for cron when we needed to set the value. So that
 it reads from the db and updates.

 Still Looking for a permanent Solution not sure despite updating the
 object cache why get_option returns old value.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17519>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list