Opened 4 years ago
#53607 new defect (bug)
Loading or saving a post with enough (large) revisions exhausts available memory
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.7.2 |
Component: | Revisions | Keywords: | |
Focuses: | performance | Cc: |
Description
This is a follow-up to #34560.
What steps should be taken to consistently reproduce the problem?
- create a post with enough (large) revisions (see "Steps to reproduce" from #34560).
- Reduce
WP_MAX_MEMORY_LIMIT
so that it is enough to load one revision but not enough to load tens / hundreds of revisions (e.g. 128M) - save post ->
Updating failed. The response is not a valid JSON response.
- edit post ->
**Fatal error**: Allowed memory size of 134217728 bytes exhausted
Does the problem occur even when you deactivate all plugins and use the default theme?
- yes
Likely cause
It seems full post revisions (including post content) are still being loaded when editing a post. This is likely the cause of high memory consumption. To look into this:
- on a standard WordPress installation, activate https://wordpress.org/plugins/debug-bar/ with
<?php define( 'SAVEQUERIES', true ); ?>
- edit a post with revisions enabled
- check the "Queries" tab of the debug bar (might need to turn off Gutenberg full screen mode to see it) and look for the query that loads the exhaustive list of full revisions (
wp_posts.*
):
SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_parent = [[THE CURRENT POST ID]] AND wp_posts.post_type = 'revision' AND ((wp_posts.post_status = 'inherit')) ORDER BY wp_posts.post_date DESC, wp_posts.ID DESC
Attachments (3)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Saving a post with enough large revisions