[wp-trac] [WordPress Trac] #24958: Large number of revisions cause memory exhaustion

WordPress Trac noreply at wordpress.org
Mon Dec 29 01:07:53 UTC 2014


#24958: Large number of revisions cause memory exhaustion
------------------------------------+-----------------------------
 Reporter:  jshreve                 |       Owner:
     Type:  defect (bug)            |      Status:  new
 Priority:  low                     |   Milestone:  Future Release
Component:  Revisions               |     Version:  3.6
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+-----------------------------
Changes (by adamsilverstein):

 * keywords:  has-patch => has-patch dev-feedback


Comment:

 [attachment:24958.3.diff] Limits the query for `wp_get_post_revisions` in
 `wp_save_post_revision` where we are looking for the last non autosave
 revision... Now we only look back 100 revisions to find the last non
 autosave (or create a new one anyway).

 This should fix the out of memory error in `wp_update_post`

 Noticed that `wp_get_post_autosave` uses the same code, limiting here has
 other issues, but note that this function will still consume memory trying
 to select all revisions at once.

 For the issue on the revisions screen itself, the initial bootstrap build
 in `wp_prepare_revisions_for_js` is selecting all the revisions to get
 their meta, we would have to adjust how this is built for large numbers of
 revisions, or not provide the meta at run time, only the IDs - this would
 allow for an ID only query which would consume far less memory. The JS
 could handle this dynamic meta loading after some adjusting. Searching
 core, thats it for use of `wp_get_post_revisions` that aren;t already
 limited, other than the meta-box, which I believe we are removing anyway.

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


More information about the wp-trac mailing list