Symptoms
You might receive email notifications similar to the following:
Website "..." (https://domain.com): Failed to reset cache for the instance #1
Description
The error message is suggesting that the cache reset command (wp-toolkit --clear-cache) is failing for some instances. You should be able to reproduce the issue with the following command:
wp-toolkit —list | awk ‘NR>1’ | awk ‘{print $1 “ “ $6}’ | while read NUM WEBSITE; do printf “%s \n” $WEBSITE && wp-toolkit —clear-cache -instance-id $NUM;done
The issue is usually caused by PHP memory_limit value
strace -T -f -yy -vvv -s 1024 -o /tmp/strace.strace wp-toolkit —clear-cache -instance-id 1
[……………] 18895 write(10</home/USER/public_html/dev/error_log>, “[28-Dec-2021 15:48:45 UTC] PHP Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 32768 bytes) in /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/php-cli-tools/lib/cli/Colors.php on line 1\n”, 242) = 242 <0.000016>
Workaround
You need to increase the memory_limit value for the relevant PHP installations on your server to avoid this issue. You can refer to this article for further information on how to do that:
How to set or increase PHP INI memory_limit or other values?