I am trying to: normal use of the website
Link to a page where the issue can be seen: you can't see the error on screen but it goes to the log file
I expected to see: no issues with the site
Instead, I got: the following error being logged repeatedly even after raising the memory limit first to 256M then to 320M. I replaced the client account name in the paths below with ------. Otherwise this is exactly what shows up in the WooCommerce fatal-errors log:
2024-05-07T18:06:19+00:00 Critical Allowed memory size of 335544320 bytes exhausted (tried to allocate 20480 bytes)
Additional context
{
"error": {
"type": 1,
"file": "\/home\/------\/public_html\/wp-content\/plugins\/types\/vendor\/toolset\/types\/embedded\/classes\/loader.php",
"line": 91
},
"backtrace": [
{
"file": "\/home\/------\/public_html\/wp-content\/plugins\/woocommerce\/includes\/class-woocommerce.php",
"line": 378,
"function": "critical",
"class": "WC_Logger",
"type": "->"
},
{
"function": "log_errors",
"class": "WooCommerce",
"type": "->"
}
]
}
Hi there
Looking at the plugin source code pertaining to the error, it looks like it is related to caching post meta values for posts returned by some query.
Which leads me suspect that the site has a lot of post meta.
How big is the wp_postmeta table?
If the site is very large, it may simply need more resources, and you would need to raise the available memory further, e.g. to 512Mb.
Does it cache the entire postmeta table, not just the rows with relevant keys, every time? Such that all the meta for all the WC orders gets cached whether needed or not? That could explain the issue but having to buy a bigger server to solve that v. having a smarter caching aaproach seems expensive.
Hi,
> Does it cache the entire postmeta table, not just the rows with relevant keys, every time?
- The function in question, caches all the custom field values for the posts returned by a WordPress query.
This means that if there are too many posts, too many custom fields, and/or too long custom field values, more processing memory will be needed.
Have you tried increasing the available memory to 512Mb, as Nigel recommended?
regards,
Waqar
Yes, I increased it to 512M and still got the memory exhausted error. 512M is larger than the entire database.
Ok, in that case, we'll need to examine the custom fields that are involved here.
Can you please share the temporary admin login details of the website? I'll also need your permission to download its clone/snapshot, to troubleshoot this on a different server too.
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
There is a lot of cusotmer data on this server so not sure I can share access / allow a clone. I'll check with the client. However, I haven't had a memory exhausted error in a few days. I think the memory problem was caused by a UPS Shipping plugin, not by Toolset even though it got logged as a Toolset error in the log. The UPS Shipping Plugin provider issued an update and it seems to have solved the memory issue.
I will keep an eye on it for a few days and if there are no more errors you won't need access and can close this ticket.
Thanks for the update and glad that it looks sorted.
Let us know if you need any further assistance.