We are experiencing some memory issues and can’t identify what is going on. It doesn’t happen everytime you try to load a page but does happen very frequently (like every other time). The error we are seeing in /srv/www/www.woodgrain.com/logs/error.log is:
FastCGI sent in stderr: “PHP message: PHP Fatal error: Allowed memory size of 100663296 bytes exhausted (tried to allocate 20480 bytes) in /srv/www/www.woodgrain.com/releases/20190423055327/web/wp/wp-includes/meta.php on line 846” while reading response header from upstream, client: 69.92.17.106, server:
www.woodgrain.com
, request: “GET /autodiscover/autodiscover.xml HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php-fpm-wordpress.sock:”, host: “
www.woodgrain.com
”
We have tried adjusting the FastCGI Buffer size to 8 32k and that hasn’t made a difference.
Thanks!
I hadn’t but you mentioning WP version reminded me there was an update available… unfortunately we are getting the same error after updating. The code inside wp/wp-includes/meta.php is as follows:
if ( ! empty( $meta_list ) ) {
foreach ( $meta_list as $metarow ) {
$mpid = intval( $metarow[ $column ] );
$mkey = $metarow['meta_key'];
$mval = $metarow['meta_value'];
// Force subkeys to be array type:
if ( ! isset( $cache[ $mpid ] ) || ! is_array( $cache[ $mpid ] ) ) {
$cache[ $mpid ] = array();
if ( ! isset( $cache[ $mpid ][ $mkey ] ) || ! is_array( $cache[ $mpid ][ $mkey ] ) ) {
$cache[ $mpid ][ $mkey ] = array();
// Add a value to the current pid/key:
$cache[ $mpid ][ $mkey ][] = $mval;
Based on that, my uneducated guess is that you have a huge number of rows of whatever type of content this is iterating over, and it’s leading to a loop that runs for a very very very long time. If you can duplicate your production site locally, I’d start sticking some var_dump($var); die(); in meta.php to see what kind of data it’s processing and what the scale of that data looks like. Based solely on the variable names used in the snippet of code it looks like this is iterating over meta fields, so maybe you’ve got something that’s generating a huge number of meta fields on something?
smashcreative:
We have tried adjusting the FastCGI Buffer size to 8 32k and that hasn’t made a difference.
Just the buffers or the buffer size too? Needed this on a recent build:
nginx_fastcgi_buffers: 8 16k
nginx_fastcgi_buffer_size: 16k
@ben I put the following inside group_vars/main.yml and re-provisioned with nginx tags. Should I have put them somewhere else?
nginx_fastcgi_buffers: 8 32k
nginx_fastcgi_buffer_size: 32k
Still getting the same errors.