[wp-trac] [WordPress Trac] #24958: Large number of revisions cause memory exhaustion
WordPress Trac
noreply at wordpress.org
Thu Mar 22 18:54:44 UTC 2018
#24958: Large number of revisions cause memory exhaustion
------------------------------------+------------------------------
Reporter: jshreve | Owner: adamsilverstein
Type: defect (bug) | Status: assigned
Priority: low | Milestone: Future Release
Component: Revisions | Version: 3.6
Severity: normal | Resolution:
Keywords: has-patch dev-feedback | Focuses:
------------------------------------+------------------------------
Comment (by pembo13):
I'm still seeing this issue, WordPress version 4.9.4 Same error:
{{{
PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried
to allocate 81920 bytes)
}}}
Checking the revisions:
{{{
SELECT COUNT(*) FROM `wp_posts` WHERE post_parent = '1978' AND post_type =
'revision'
}}}
Yields 537.
Looking at `$revisions = wp_get_post_revisions( $post_ID );` it seems like
it's loading the entire post, but only information to generate the list
are needed (ID, post_author, post_date, post_title). Can we just reduce
the fields that are being loaded?
The database really doesn't mind 500+ rows, the issue is the PHP code
trying to load all 500 posts in their entirety.
----
Stack Trace:
{{{
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to
allocate 81920 bytes) in /var/www/wordpress/example.com/wp-includes/wp-
db.php on line 1889, referer: https://example.com/wp-
admin/edit.php?post_type=page
Stack trace:, referer: https://example.com/wp-
admin/edit.php?post_type=page
1. {main}() /var/www/wordpress/example.com/wp-admin/post.php:0,
referer: https://example.com/wp-admin/edit.php?post_type=page
2. include() /var/www/wordpress/example.com/wp-admin/post.php:174,
referer: https://example.com/wp-admin/edit.php?post_type=page
3. wp_get_post_revisions() /var/www/wordpress/example.com/wp-admin
/edit-form-advanced.php:231, referer: https://example.com/wp-
admin/edit.php?post_type=page
4. get_children() /var/www/wordpress/example.com/wp-
includes/revision.php:453, referer: https://example.com/wp-
admin/edit.php?post_type=page
5. get_posts() /var/www/wordpress/example.com/wp-includes/post.php:445,
referer: https://example.com/wp-admin/edit.php?post_type=page
6. WP_Query->query() /var/www/wordpress/example.com/wp-
includes/post.php:1704, referer: https://example.com/wp-
admin/edit.php?post_type=page
7. WP_Query->get_posts() /var/www/wordpress/example.com/wp-includes
/class-wp-query.php:3230, referer: https://example.com/wp-
admin/edit.php?post_type=page
8. wpdb->get_results() /var/www/wordpress/example.com/wp-includes
/class-wp-query.php:2831, referer: https://example.com/wp-
admin/edit.php?post_type=page
9. wpdb->query() /var/www/wordpress/example.com/wp-includes/wp-
db.php:2488, referer: https://example.com/wp-admin/edit.php?post_type=page
10. mysqli_fetch_object() /var/www/wordpress/example.com/wp-includes/wp-
db.php:1889, referer: https://example.com/wp-admin/edit.php?post_type=page
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/24958#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list