WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 20 months ago

#5199 closed defect (bug) (worksforme)

Options object cache can become out of sync with the database.

Reported by: markjaquith Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.2.3
Component: Cache API Keywords: close
Focuses: Cc:

Description

I have a client with a high volume site (both in terms of view and in terms of entries posted that has been having problems with future-published entries sometimes not publishing at their correct times. I've been monitoring things, and it seems that when problems occur, the object cache has become out of sync with the database. We're using the APC backend in this case, though I don't think that's the cause of the issues.

Specifically, sometimes the database "cron" entry will have cron items that aren't found when you get_option('cron');

There may be a race condition with concurrent updates.

We can likely improve this in the option API, but we might not be able to eliminate it entirely. It may be prudent to revisit our method of storing cron entries, as an option is not a good place to store a frequently-updated serialized array.

The idea of a multi-use "meta" table has been floated, and this might be another good use of that, as cron entries could have their own meta type.

Change History (12)

comment:1 markjaquith7 years ago

Caught it with two conflicting values (note the different publishing times). The one in the DB was right, but not the one in the cache.

_get_cron_array() :

Array
(
   [1192545034] => Array
       (
           [publish_future_post] => Array
               (
                   [c718cfbf7e9d1a40c454cc48cebbe5a7] => Array
                       (
                           [schedule] =>
                           [args] => Array
                               (
                                   [0] => 11915
                               )

                       )

               )

       )

)




DB:

Array
(
   [1192543234] => Array
       (
           [publish_future_post] => Array
               (
                   [c718cfbf7e9d1a40c454cc48cebbe5a7] => Array
                       (
                           [schedule] =>
                           [args] => Array
                               (
                                   [0] => 11915
                               )

                       )

               )

       )

)

comment:2 lloydbudd6 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.5 to 2.6

comment:3 hakre5 years ago

I guess this is APC related. Please disable APC and try to reproduce.

comment:4 Denis-de-Bernardy5 years ago

  • Keywords reporter-feedback added; needs-patch removed
  • Milestone changed from 2.9 to 2.8

is this still current in trunk (transcients, new cron procedure...)?

comment:5 DD325 years ago

is this still current in trunk (transcients, new cron procedure...)?

Yes.

They mearly use the Object Cache/Database, However, Transient use does mean the database should hopefully not get the data in the first place..

To me, This sounds like the APC cache is not updating itself for some reason.. I somewhat doubt its a WP issue.. but it might depend on the object cache file in use.

comment:6 ryan5 years ago

  • Component changed from General to Cache
  • Milestone changed from 2.8 to Future Release
  • Owner anonymous deleted

comment:7 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added; reporter-feedback removed

comment:8 Denis-de-Bernardy5 years ago

  • Milestone changed from Future Release to 2.9
  • Priority changed from high to normal
  • Severity changed from major to normal

comment:9 ryan4 years ago

  • Milestone changed from 2.9 to Future Release

comment:10 solarissmoke3 years ago

  • Keywords close added

This ticket was raised back when there was persistent caching in core. Is it still relevant now?

comment:11 solarissmoke2 years ago

  • Keywords needs-patch removed

comment:12 nacin20 months ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Going to close this. Our various changes with regards to cron locking has very likely made this much better.

Note: See TracTickets for help on using tickets.