[wp-trac] [WordPress Trac] #25623: The design of update_option etc makes race conditions likely to happen

WordPress Trac noreply at wordpress.org
Mon Jan 26 12:42:30 UTC 2015


#25623: The design of update_option etc makes race conditions likely to happen
-------------------------------------------+-----------------------------
 Reporter:  joehoyle                       |       Owner:
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  Future Release
Component:  Cache API                      |     Version:
 Severity:  normal                         |  Resolution:
 Keywords:  reporter-feedback needs-patch  |     Focuses:
-------------------------------------------+-----------------------------

Comment (by joehoyle):

 Ok, new idea: Rather then getting rid of the idea of `alloptions`, which
 would add too many Object Cache `get` calls for people using a persistent
 object cache; this issue would pretty be much eradicated if we just
 deleted the `alloptions` cache pre `add/delete/update` option. This would
 cause a re-fetch of the options from the DB before pushing those options
 back into the object cache. Though this isn't 100% atomic, it vastly
 reduces the changes of data corruption as the possible window for a race
 condition is `Fetch DB Rows -> Push to Object Cache` rather than `Start of
 Script -> Push to Object Cache` that is currently is (which is a huge
 issue when running long background tasks etc).

 I don't think the performance hit will be significant, as
 update/add/delete options are already pretty expensive operations so
 aren't used in "view" contexts.

 This should be a pretty straight forward patch, any thoughts before I
 submit one?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/25623#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list